Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception : Additional text encountered after finished reading JSON content #1261

Closed
mvadu opened this issue Mar 27, 2017 · 3 comments
Closed

Comments

@mvadu
Copy link

mvadu commented Mar 27, 2017

I am using this amazing library to read JSON response from InfluxDB. With Chunked responses, the class is similar to Online generated

public class Series
{
    public string name { get; set; }
    public List<string> columns { get; set; }
    public List<List<object>> values { get; set; }
    public bool partial { get; set; }
}

public class Result
{
    public int statement_id { get; set; }
    public List<Series> series { get; set; }
    public bool partial { get; set; }
}

public class RootObject
{
    public List<Result> results { get; set; }
}

The response I get from InfluxDB is

{"results":[{"statement_id":0,"series":[{"name":"ChunkTest","columns":["time","Val"],"values":[[1490584276233503400,0],[1490584276247138800,1],[1490584276263674700,2],[1490584276277906600,3],[1490584276293388400,4],[1490584276311209600,5],[1490584276326084200,6],[1490584276341423000,7],[1490584276357200800,8],[1490584276372130200,9]],"partial":true}],"partial":true}]}
{"results":[{"statement_id":0,"series":[{"name":"ChunkTest","columns":["time","Val"],"values":[[1490584276700208200,30],[1490584276716050800,31],[1490584276731527700,32],[1490584276746938100,33],[1490584276763240500,34],[1490584276778480700,35],[1490584276793635900,36],[1490584276809912100,37],[1490584276825775700,38],[1490584276841033300,39]],"partial":true}],"partial":true}]}
{"results":[{"statement_id":0,"series":[{"name":"ChunkTest","columns":["time","Val"],"values":[[1490584276856816700,40],[1490584276871956700,41],[1490584276887248800,42],[1490584276903294600,43],[1490584276918772500,44],[1490584276935431700,45],[1490584276950390900,46],[1490584276965931500,47],[1490584276981850300,48],[1490584276996947400,49]]}]}]}

While trying to parse this I am getting an exception Newtonsoft.Json.JsonReaderException with an message Additional text encountered after finished reading JSON content: {. Path '', line 2, position 0.
THe position is for the second line, but I am not sure what is the issue, the same content in the online class generator (which too uses same library) is just fine.

Note: The class is correct, and if I get only one line it just works fine.

@JamesNK
Copy link
Owner

JamesNK commented Mar 27, 2017

Ask on Stackoverflow

@mvadu
Copy link
Author

mvadu commented Mar 27, 2017

@JamesNK Thanks, I found that the InfluxDB is sending a malformed JSON, raised influxdata/influxdb#8212

@Chloedunwoody
Copy link

Having a similar issue is there a fix to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants