我需要从Firebase
的默认值的Remote config
中获取JSONObject
。通过FirebaseRemoteConfig.getString()
,它会被转换成字符串,但不是JSONObject
,提示如下:
org.json.JSONException: Unterminated object at character xx
以下是远程config
的默认值:
<entry>
<key>welcome_message</key>
<value>{"version" :1,"type":"category","name":"CATEGORY"}
</value>
</entry>
现在我附上我的Java代码:
String welcomeMessage = mFirebaseRemoteConfig.getString(WELCOME_MESSAGE_KEY);
JSONObject categoryListInJson = new JSONObject(welcomeMessage);
感谢您提供答案。