• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

JSON Object Data verification

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,Im new to Java and I have a JSON out put as below that I take it from JSON.stringify(). I need to verify whether value of each item is correct.
However when I tried to read the content I always get “NULL” . when I use the whole object “profile “ I get the whole data set not individually.

I feel it something to do with the conversion.

Any Ideas would be helpful  


Fetch JSON Data

             Gson gson1=new Gson();
             JSONParser jsonp= new JSONParser();
             JSONObject jsontext1 = (JSONObject)jsonp.parse((String) evaluateJavascript("return JSON.stringify(Data)"));


Read JSON



Or  


Output Results:
[INFO]
[ERROR] Errors:
[ERROR]   null


JSON Object Data set




 
Marshal
Posts: 3457
493
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSON object is not valid.  The values for SUB1, SUB2, and email should be enclosed in quotes.


PS: Please use Code Tags when you include code and data in your post
 
Sham Weston
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Ron McLeod. thanks  , actually they are enclosed in quotes.  (i corrected that in the post now)
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic