R
Rama Singh
I am getting my data in JSON format, how can i validate or Parse JSON
data in rails.
Please help me,
Thanks & Regards,
Rama
data in rails.
Please help me,
Thanks & Regards,
Rama
I am getting my data in JSON format, how can i validate or Parse JSON
data in rails.
Please help me,
Thanks & Regards,
Rama
you could use the json gemRama said:I am getting my data in JSON format, how can i validate or Parse JSON
data in rails.
Please help me,
Thanks & Regards,
Rama
Marcin said:RTFM?
but seriously - gogle for ruby JSON - first result gives you ruby JSON
library:
if you have data in JSON do @j = JSON.parse(json_data)
if you want to generate JSON from hash/array - json_data =
JSON.unparse(@hash)
^Rama said:In the above code "olvID" variable get JSON data, i want to check iam
getting valid JSON or not, for that i used "@j = JSON.parse(olvID)", but
i get error :
c:/ruby/lib/ruby/site_ruby/1.8/json.rb:300:in `parse_object': expected
',' or '}' in object at '"Val
ue":"",}},"MetaC'! (JSON:arserError)
Florian said:^
This isn't allowed in a valid JSON text.
I think this time you understood what actually i am looking for :
1. I get AsJSON data.
2. I want to parse JSON data in ruby.
James said:But as Florian said, you JSON data is not valid JSON. That's why the
Ruby parser won't parse it.
James Edward Gray II
data into textarea and i can check from there regarding JSON validation.
Chris said:
I just wanted to check my JSON data is valid or not,
either from website or from command prompt.
If you want to know if it is valid, and you have access to a JS
interpreter (e.g. a web browser) then you could simply eval() it and
see if it compiles or not.
Thanks Florian.
Thanks James, I found the error in JSON txt.
My last question is there any online website, where i can paste my JSON
data into textarea and i can check from there regarding JSON validation.
Thanks
Rama
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.