Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json parsing without array name #5

Closed
lnkien opened this issue May 14, 2016 · 1 comment
Closed

Json parsing without array name #5

lnkien opened this issue May 14, 2016 · 1 comment
Labels

Comments

@lnkien
Copy link

lnkien commented May 14, 2016

I have a Json Array as string without name and I want to parse it how can i do it i ? Thank you.

["abc","def","123","456", "890"].

@sunshinejr
Copy link
Owner

Hey! Thanks for filling in the issue. 🎉

Unfortunately you cannot do this right away using our library. If the string is really a JSON array (meaning it has JSON format), you can do the following:

  1. Parse the object as a String, e.g. using mapObject().
  2. When you have the object parsed, let's say with a name object, now you can parse it to data using NSJSONSerialization. Like:
NSJSONSerialization.dataWithJSONObject(object, options: .PrettyPrinted)

Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants