Is it ok to save a JSON array in SharedPreferences?

前端 未结 9 2153
不知归路
不知归路 2020-11-28 08:29

I have a JSON Array that I need to save. I was thinking about serializing it, but would it be better to just save it as a string in SharedPreferences and then rebuild it whe

9条回答
  •  情深已故
    2020-11-28 09:06

    Yes. Values saved with SharedPreferences must be primitives or Strings. What form would the serialized JSON object take if not primitive or String (or Set)? JSON is a serialized data format. Use it, if that's what you've already got.

提交回复
热议问题