Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Elaborated actual question. Expanded tags.
Link

Converting JSON data to Java object

Question Protected by Community Bot
improved formatting: I used Notepad++ with the JsonViewer plugin to format this string :)
Source Link

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like:

{'title': 'Computing'ComputingandInformationsystems',
 and Information systems','id':1,'children': 'true','groups':
 'groups': [{'title': 'Level'LeveloneCIS',
 one CIS','id':2,'children': 'true','groups':[{'title': 'Intro'IntroToComputingandInternet',
 To Computing and Internet','id':3,'children': 'false','groups':[]}]}]}

In this string every JSON object contains an array of other JSON objects. The intention is to extract a list of IDs where any given object possessing a group property that contains other JSON objects. I looked at Google's Gson as a potential JSON plugin. Can anyone offer some form of guidance as to how I can generate Java from this JSON string?

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like:

{'title': 'Computing and Information systems','id':1,'children': 'true','groups':
 [{'title': 'Level one CIS','id':2,'children': 'true','groups':[{'title': 'Intro To Computing and Internet','id':3,'children': 'false','groups':[]}]}]}

In this string every JSON object contains an array of other JSON objects. The intention is to extract a list of IDs where any given object possessing a group property that contains other JSON objects. I looked at Google's Gson as a potential JSON plugin. Can anyone offer some form of guidance as to how I can generate Java from this JSON string?

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like:

{'title': 'ComputingandInformationsystems',
 'id':1,'children': 'true',
 'groups': [{'title': 'LeveloneCIS',
 'id':2,'children': 'true','groups':[{'title': 'IntroToComputingandInternet',
 'id':3,'children': 'false','groups':[]}]}]}

In this string every JSON object contains an array of other JSON objects. The intention is to extract a list of IDs where any given object possessing a group property that contains other JSON objects. I looked at Google's Gson as a potential JSON plugin. Can anyone offer some form of guidance as to how I can generate Java from this JSON string?

Loading
deleted 19 characters in body
Source Link
Faiyet
  • 5.5k
  • 14
  • 54
  • 67
Loading
Added Java tag
Link
Vincent Ramdhanie
  • 103.3k
  • 23
  • 143
  • 196
Loading
Source Link
Faiyet
  • 5.5k
  • 14
  • 54
  • 67
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /