How to read a gated JSON string in Java

I apologize for the help, as it really makes me wait a long time. From JSP I passed the stingnify JSON object as a String to a Java action, it kind of

String jsonDealer = [{"dealerID":"VARSSWK103","dealerName":"NPD STATION SDN BHD"},
{"dealerID":"VARSSTH008","dealerName":"Winjaya Teleshop"}]

How can I convert this to a Dealer JSON / or ArrayList object so that I can get the dealer ID and dealer name?

Thanks for the help!

+3
source share
2 answers

, JSON, - , JSON, . JSONObject JSONArray Tapestry. download Tapestry 5 , tapestry-core-5.0.18.jar , , JSONObject, JSONArray String, api .

-1

http://json-lib.sourceforge.net/ .

. http://json-lib.sourceforge.net/snippets.html

String str = "{'dealerName':'NPD STATION SDN BHD', 'dealerID': 1, 'dealerReputation': 2.0, 'dealerActive': true}";  
JSONObject jsonObject = (JSONObject) JSONSerializer.toJSON( str );

String str = "['NPD STATION SDN BHD', 1, 2.0, true]";  
JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON( str );
-1

Source: https://habr.com/ru/post/1780171/


All Articles