Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a string that looks like the following which I have to convert to a JSON object

VL-782597{n=1 c=[3:2.000, 5:1220121144134420.000, 6:4.000, 7:35.000] r=[5:549054495275037.560, 7:5.000]}

For JSON parse the names must be in quotes which is not there in the string I have.

And the values are assigned as both = and : instead of : only

VL-782597 is like row id

How do I format it into JSON from jquery/javascript. Is this a commonly used format ?

share|improve this question
That's not even a valid JavaScript. How do you get that string? – undefined Dec 28 '12 at 10:00
How would you like the json to look like? After that the javascript string functions are your friend... – rene Dec 28 '12 at 10:00
2  
You will need to parse the string and transform it as appropriate. You need to insert missing quotes, change = to :, insert missing commas, remove/replace the leading VL-.... – flem Dec 28 '12 at 10:04
There's no such thing as "JSON object". You probably mean either a JSON string or a JavaScript object. – Álvaro G. Vicario Dec 28 '12 at 10:06
No it is not Javascript , it is output of another app, I am stuck using it as a string. Yes ,either of JSON string or javascript object is what i need. – user568109 Dec 28 '12 at 10:58

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.