0

I have a json data that I need to be parse in java
The data is in the form

["string1","string2","string3",...]


Any idea how I can do that?

asked Feb 17, 2012 at 13:15
2

3 Answers 3

2

You can use JacksonJSON. For a good tutorial, have a look here.

answered Feb 17, 2012 at 13:20
Sign up to request clarification or add additional context in comments.

Comments

1

You can use GSON api and use the code as below

Type type = new TypeToken<Collection<String>>(){}.getType();
List<String> results = new Gson().fromJson(json, type);

http://code.google.com/p/google-gson/

answered Feb 17, 2012 at 13:19

Comments

1

It depends a bit on how complete you want toe JSON parsing to be. If the above example is representative of all you expect, you might as well do some good old string parsing with indexOf and split.

If you want more complete JSON parsing, I'd suggest looking at the official json.org site and their Java page

answered Feb 17, 2012 at 13:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.