Skip to content

convert string to JSON with special character \u #629

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
Run this java code:
JsonParser parser = new JsonParser();
 JsonElement element = parser.parse("{\"description\":\"c:\\userDescription.txt\"}");
 JsonObject attributes = element.getAsJsonObject();
 System.out.println(attributes);

Expected output:
{"description":"c:\userDescription.txt"}

but actually, I see:
Exception in thread "main" com.google.gson.JsonSyntaxException: 
java.lang.NumberFormatException: For input string: "serD"



 I use Gson 1.5.

Please provide any additional information below.

Original issue reported on code.google.com by nhutnguy...@gmail.com on 3 Mar 2015 at 4:34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions