In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how Java converts String into json objects or json arrays". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Convert String to json objects or json arrays
The SmartProejctEquipmentMap here is an entity class that I customize, and you can define the transformation yourself.
Note: the name of the key in the json string should be the same as the entity class.
@ Test public void TestJsonObject () {String datajson = "" + "[" + "{" + "'projectId':'00a8de32-422cmure 4b8dmurb945Muthd9cda7f30a31' "+" projectName':' annual production of 720 million chip components, 396 million solid polymer capacitors and other projects (standard workshop, corridor A Class A warehouse, office building, dormitory, guard on duty Garbage room)', "+" 'iconType':'yc', "+"' eqpType':'yc', "+" 'sn':'SZWJJJ8MQX20200403134027', "+"name':' test third party 01mm," + "' wkt':' test third party 01' "+" 'sn':'POINT (120.698299 31.272362)' "+"}, "+" {"+" 'projectId':'00a8de32-422cmur4b8dmurb945Muthd9cda7f30a31", "+"' projectName':' test project number name' "+" 'iconType':'yc', "+"' eqpType':'yc', "+" 'sn':'FDASDFAFDAFYF89AS6F897DD', "+"name':' dust equipment 001mm," + "" wkt':' dust equipment 001' "+" 'sn':'POINT (120.698299 31.272362)' "+"} "+"] " JSONArray jsonArray = JSONArray.parseArray (datajson); for (int item0; i0) {for (int iTuno Tinci)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.