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

How do you convert jsonarray to List<Something> #81

Closed
bjartek opened this issue Sep 22, 2015 · 4 comments
Closed

How do you convert jsonarray to List<Something> #81

bjartek opened this issue Sep 22, 2015 · 4 comments

Comments

@bjartek
Copy link

bjartek commented Sep 22, 2015

Specifically how do you get an adapter for this type of structure?

Quasi code for reference:

String json = "[
{ "name" : "foo" },
{ "name" : "bar"}
]";

public class Name {
public final String name;
...
}

Moshi moshi = new Moshi.Builder().build().
JsonAdapter<???> adapter = moshi.adapter(??)
List names = adapter.fromJson(json);

@serj-lotutovici
Copy link
Contributor

Take a look here #78

@bjartek
Copy link
Author

bjartek commented Sep 22, 2015

Thanks for the link. In 0.9.0 it looks like Types is package default. I guess this was fixed after the 0.9.0 release?

@serj-lotutovici
Copy link
Contributor

Yep... according to the commit messages it @JakeWharton fixed it after. But you can use the 1.0.0-SNAPSHOT. I'm not using it in production yet, but it works quite well in a development branch.

@bjartek
Copy link
Author

bjartek commented Sep 22, 2015

Ok. Thanks for the information. Closing.

@bjartek bjartek closed this as completed Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants