简体   繁体   中英

How can i parse json object containing slashes in java

I want to parse a windows path in java. this is part of the json:

..."sslkey":"c:\usr\ssl\key.jks"

and this is the code:

JsonObject jsonargs = gson.fromJson(args[0], JsonObject.class);
SSLKEY = jsonargs.get("sslkey").getAsString();

I tried with \ also in the value, but the error that I have is:

Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 133 path $.sslkey

Could you please tell me how I can fix this?

Thank you !

Thank you, i tried many things, it seems that: is also special char. I used base64 encode in php and base64 decode in java.. so all fine:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM