"Unable to parse server JSON message" dirty fix

  • 19
  • Problem
  • Updated 6 years ago
  • Solved
If you're having this error message while updating CSS or JS files, you can try this dirty fix:

Open file (userdata folder)\Mozilla\Firefox\Profiles\(your profile folder)\extensions\xrefresh@xrefresh.com\chrome\content\xrefresh.js

Find the line 134 (var buffer = UTF8.decode(parts[i]);)
AFTER, add:

var contentRegex =/"contents":\{(.*?):/i;
var regexpResult = buffer.match(contentRegex);
if ( regexpResult ) {
var path = regexpResult.pop();
var newPath = path.replace(/\/gi, "\\");
var newBuffer = buffer.replace(path, newPath);
buffer = newBuffer;
}


Restart Firefox.

The problem is related to xRefresh monitor not escaping correctly path slashes.
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes

Posted 7 years ago

  • 19
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
yes, windows monitor has really bad JSON implementation :(
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes
Curious thing is other paths get escaped just fine. Only the "contents" path have problems. Anyway, this fix works for me :)
Photo of chocksy

chocksy

  • 1 Post
  • 0 Reply Likes
Thanks this fixed it. :)
Photo of desjardins.gabriel

desjardins.gabriel

  • 1 Post
  • 0 Reply Likes
works for me... thanks
Photo of Manuel Razzari

Manuel Razzari

  • 3 Posts
  • 0 Reply Likes
Fix worked for me. Sad if this affects all Windows users because this is an awesome add-on.
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
Yes, that is sad. But I'm not on windows anymore. So this has a really low priority for me. You know, I'm doing these projects for myself and sharing is a little bit as a side-effect...
Photo of Manuel Razzari

Manuel Razzari

  • 3 Posts
  • 0 Reply Likes
FYI, I'm using this add-on not only for the speed benefit but because every saved keystroke helps alleviate my RSI pain. Just so you know your little projects can have nice and unexpected effects on people :)
Photo of Influx Web

Influx Web

  • 1 Post
  • 0 Reply Likes
Alright it works for me.

i'll report this fix on my blog from http://Influx-web.com.
Photo of charles.roper

charles.roper

  • 1 Post
  • 0 Reply Likes
If I fork on github, apply this patch, then issue a pull request, will you include it in a new release?
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
Hi Charles. Thanks, but wouldn't it be better to fix the real bug on xrefresh monitor side?

This solution is just a hack which does not cure the cause of the bug. And releasing a new version is still quite work for me ... :-/
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes
Yep, in fact I believe this error is still present on IE side because the monitor keeps sending bad formatted Json. I'm glad the hack get useful to users but is not really solving the problem
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
Is anyone using IE with XRefresh? I doubt. IE support will be dropped in the future.
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes
Well, I'm using it on IE7/8 along with Firefox, sometimes both at the some time, and this saves me some time of post-compatibility tests. Even I would like to have a webkit version, but IE is more important because Trident is the most used engine in the world and behave very different than Gecko/webkit, that usually are in par.
Photo of Manuel Razzari

Manuel Razzari

  • 3 Posts
  • 0 Reply Likes
Yes, I do use it. I use these http://finalbuilds.edskes.net/iecolle... to test sites in IE after having tested on Firefox, and of course XRefresh saves a lot of reloads.

Not much of a big deal though. I mean if you ask me, I'd rather you spend your little and valuable time on features or fixes to the core FF + Win setup, rather than fixing IE.
Photo of Andy Potanin

Andy Potanin

  • 2 Posts
  • 0 Reply Likes
Fix works as of today, thank you!
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes
I'm now using Newtonsoft.Json.Net20.dll 3.5 release 8 and seems to solve the problem without the need of the dirty fix.

You can try: download it form http://json.codeplex.com/releases/vie...
Then, replace the Newtonsoft.Json.Net20.dll file on your "program files/xrefresh" folder.

If working ok, perhaps Antonin could release a fix version.
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
Thanks a lot! I will release new xrefresh version the next week (final Firebug 1.6 is expected)
Photo of Antonin Hildebrand

Antonin Hildebrand, Developer

  • 2166 Posts
  • 276 Reply Likes
Please upgrade to XRefresh Monitor 1.5:
http://code.google.com/p/xrefresh/dow...

I tested it briefly and all seems to be working fine.

Hope this solves all JSON encoding problems on Windows.

You may also want to grab new Firefox addon (v1.5). It brings compatibility with Firebug 1.6.
Photo of druellan

druellan

  • 6 Posts
  • 0 Reply Likes
Thanks Antonin. I will check it out :)
Photo of corneliu

corneliu

  • 2 Posts
  • 0 Reply Likes
I try to use XRefresh on a W7x64 with an ASP.Net project + FF.
If I change aspx/ascx pages FF refreshes but if I change a CSS file I get an error:

"Unable to parse server JSON message: {"date":"25/02/2010","time":"12:40:15 AM","root":"C:\\....UI","name":"d.....","type":nu"

The JSON is one specific to my app. The CSS is not refreshed.

This reply was created from a merged topic originally titled
CSS save generates a JSON error..