Skip to content

Json parse error #17

@cyphercider

Description

@cyphercider

Version: 1.0.2 (also applies to 1.0.3)
Dgraph version: 1.0.2

After running a query of the form via txn.query(...):

{
    classes(func: eq(<${sp.VertexType}>, "Class"), orderasc: ${sp.Name}) {
      uid: _uid_
      name: ${sp.Name}
      ...
}

Within your method Response.getJson(), the call to super.getJson() returns a string that is not valid Json:

"classes": [{"name":....

This results in a JSON parse error, "Unexpected token : in JSON at position 9"

Was there a recent change that would have changed the format of the string returned from super.getJson() so that it is missing an opening brace?

EDIT: the value returned from super.getJson() is determined to be Uint8 and gets put through the u8ToStr function.

EDIT 2: I have found that the last character returned from super.getJson() is ASCII character #26 ("SUBSTITUTE"). When I append a brace to the front of the result, and remove this "SUBSTITUTE" from the end, the string is valid JSON. So it looks like the query result may be incorrectly offset by 1 character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions