I've been provided with a json file to show results in a tableview. But when I tried json file validation using online json file editor then I am getting "Build tree failed" error.

I posted this message to my client about wrong json file and then he has posted some strange description which I am totally unaware.

Yes the json is not a pure json. It has javascript variables which have json variable. For now u can use a webview to evaluate the javascript variables and use the json value. For ex : dp_f : corresponds to list of departure train is a javascript array variable. U may have to eval the variable and store each array element is a new json with key as dp_f and value of array of these values

Please tell me how can I use this json file which is not pure. What is the way to parse such files ?

share|improve this question
we'll need to see the json file to help – kennypu Dec 27 '12 at 5:30
feedback

1 Answer

The only real way to evaluate JavaScript (which is really what you have, not JSON) is to evaluate JavaScript.

You will have to use some form of eval(). I recommend trying a JavaScript sandbox, if available to you. Of course the best option would be to get the data fixed.

share|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.