0

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!

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

@Catchy - please upvote and "accept" this answer - it's basically the ONLY answer: 1) If you're getting this string from some vendor (e.g. Amazon), perhaps that vendor has a library. 2) Otherwise, you'll have to parse it yourself. Looking at the format, I think writing the "parsing code" in Java might actually be pretty easy ;)
I am not good at string parsing. Can you write a demo? Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.