Javascript: Parse JSON with quotes ignoring

Server sends me correct JSON structure, which i can easily parse with

JSON.parse(rawData)

But sometimes some nodes comes in format:

"AppMode": "{\"SessionData\":{\"LastError\":0,\"GeneralID\":87}}"

AppMode value is a string, so it would not be parsed as JSON, but it suppose to be JSON. Is there a way to filter that instead of writting own parser ?

Answers


If you can't fix the server to send correct json, after parsing the raw data, parse the AppMode value:

var parsedData=JSON.parse(rawData);
parsedData.AppMode=JSON.parse(parsedData.AppMode);

Need Your Help

remove background or mark filled areas from imfill

matlab image-processing image-segmentation

I'm doing some image segmentation in matlab of grayscale images taken from a drone using a thermo sensitive camera. The idea is that you should be able to put in a video whereafter it analyzes every

.vimrc configuration file does not load when editing with 'sudo'

vim vi

I have problem with .vimrc file, the problem is that it sometimes get loaded, and sometimes not.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.