简体   繁体   中英

Convert json-like(not JSON) string to an object in Java

I have a string like:

{InstanceStatuses: [{AvailabilityZone: us-east-2b,Events: [],InstanceId: i-79e234fd, InstanceState: {Code: 16,Name: running},InstanceStatus: {Details: [{Name: reachability,Status: initializing}],Status: initializing},SystemStatus: {Details: [{Name: reachability,Status: initializing}],Status: initializing}}],}

how to convert it to an Object(like hashmap) in java? Thank you!

Where do you get those strings? Because if it is from amazon (I see an amazon tag in your question) it is very likely that an (official) parser already exists for java. If not, I think your only chance is to write a parser by your own (could get quite difficult). I think your best choice for the start is to look where you get the string and then search for a java parser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM