ermm,
this is the situation,
i have a txt file, it contains
[
{
"cmdType":"G",
"row":0,
"col":2,
"ans":"心",
"cmd":"C",
"qNum":19
},
{
"cmdType":"G",
"row":1,
"col":1,
"ans":"心",
"cmd":"C"
}
]
i need to parse that and get one of the json object that inside that
json array and send that json object as string to client. the code
that i posted on the first post only works when there is no chinese
character in it.
this is the exception i get when it has chinese character in it.
Exception in thread "main" com.google.gson.JsonParseException: Failed
parsing JSON source: java.io.BufferedReader@530daa to Json
at com.google.gson.JsonParser.parse(JsonParser.java:57)
at xwp.server.Test.main(Test.java:23)
Caused by: com.google.gson.TokenMgrError: Lexical error at line 1,
column 1. Encountered: "\ufeff" (65279), after : ""
at
com.google.gson.JsonParserJavaccTokenManager.getNextToken(JsonParserJavaccTokenManager.java:
1193)
at com.google.gson.JsonParserJavacc.jj_ntk(JsonParserJavacc.java:635)
at com.google.gson.JsonParserJavacc.parse(JsonParserJavacc.java:10)
at com.google.gson.JsonParser.parse(JsonParser.java:54)
... 1 more
i would like to know how do i get this
{
"cmdType":"G",
"row":1,
"col":1,
"ans":"心",
"cmd":"C"
}
out of the json array and send it as string to client.