Closed vervatovskis closed 7 years ago
I believe that this is a limitation with Realm as opposed to Realm-JSON.
While Realm supports storing arrays, they must be stored in an RLMArray, and RLMArrays may only contain RLMObject
s, not basic types such as a string or number. This specific change has been tracked on Realm Cocoa's issue tracker.
I would suggest structuring your data so that you are storing an array of integers with keys. You might need to do some preprocessing on that JSON to change it into something like [{"value": 6107}, {"value": 6108}, {"value": 6109}, {"value": 6110}]
and then create a RLMObject (with Value: Int
) that is stored in a RLMArray on your parent object. While this is not ideal app-side, if you're in a situation where you have control over the JSON coming down, consider changing it to confirm to jsonapi.org's latest specification which would help to avoid this issue.
Feel free to let me know if you need any further guidance, happy coding!
Thanks Max for this clear and detailed answer. It really helps :)
How can I configure/parse JSON object like this Screenshot.
More explanation: It's an array of integers without keys like this:
partitionIds: [6107,6108,6109,6110],