1

Really I like Realm but I had an issue when I try to parse my JSON, it doesn't support primitive arrays, like "Melchior" (from Realm Team) told me that : Realm currently doesn't support primitive arrays. Your JSON has this:

"languages" : ["fr", "en"]

For Realm to automatically map the JSON to your MyString class it would have to be converted to something like this:

"languages" : [ { "str" : "fr"} , { "str" : "en" } ]

The problem is I can't change my JSON so what I supposed to do. I thought to use something like that RealmLIst but it gives me that error : Error:(11, 8) error: Type java.util.ArrayList of field list is not supported waiting for your response.

Bachlet Tansime
  • 1,273
  • 3
  • 12
  • 17

2 Answers2

1

Well, in my particular case, I had a similiar problem with an ArrayList. Then, in Realm documentation, I found a solution: RealmList .

public RealmList<Email> emails;

You can view more information on this

Moises Portillo
  • 828
  • 8
  • 12
0

If you are using GSON you can write your own adapter class for mapping between a primitive array and a wrapper class. See this question here for mere details: Gson deserialization of List<String> into realmList<RealmString>

Community
  • 1
  • 1
Christian Melchior
  • 19,978
  • 5
  • 62
  • 53
  • Hi, Christian I don't use Gson, I migrate to Realm to avoid using Jackson and Gson, So if I'll use it there's no benefic to migrate...If you will soon fix it I can wait you. thank's Melchior – Bachlet Tansime Mar 18 '15 at 09:54