1

to day i faced with this problem and I do not know how it appear :( Let see my String Json

  <string name="string_config">{
  "ip": "0",
  "text": "TEXT 32",   <-- problem here
  "orientation": "1",
  "time": "1421831080740"
}</string>

I parse it by using gson

public static EnConfiguration parseConfiguration(String json) {
        if (StringUtils.isBlank(json)) {
            return null;
        }
        initGson();
        return mGson.fromJson(json, EnConfiguration.class);
    }

Let see the line : "text": "TEXT 32",.

Let "TEXT32" . then the app run normally.

let "TEXT 32". the app break. Log:

com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 73

I sure this bug is based on the space between "TEXT" and "32"

the Json String can not change. only I change my code to reach the Json

Who can tell me the problem. please

kemdo
  • 1,429
  • 3
  • 15
  • 29

1 Answers1

0

Problem is not because of space but there is a error in json string ,comma(,) is missing

<string name="string_config">{
  "ip": "0"           <-- here should be comma (,)
  "text": "TEXT 32",   <-- problem here
  "orientation": "1",
  "time": "1421831080740"
}</string>
Anand Phadke
  • 531
  • 3
  • 28
  • 1
    very sorry, I delete some key from Json because too much key value :( .....Please see the update question...... confirm run normally with this Json.............only break when set "text" to "TEXT 32" – kemdo Feb 11 '15 at 11:36