teris / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

Problem with GetString() for JSON text sent in chunks #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Having a problem regarding Value functions in document.h. Functions  
HasMember(), GetString() work when the whole JSON object is received. Is there 
a way to overcome this issue? For example, when looking for values on the fly 
is required, when JSON text sent in chunks. As an example, the following 
produces an error, as there is no an ending curly brace:

char buf[]=("{ \"objectType\" : \"world\" ");
Document d;
d.Parse<0>(buf);
Value *src = &d;
if((*src).HasMember("objectType")==true)
{
  puts((*src)["objectType"].GetString());
}

Would be nice, if smth can be done with it.

What is the expected output? What do you see instead?
Assertion failed: Isobject()...document.h, line 614

What version of the product are you using? On what operating system?
Rapidjson v0.1, Windows 7,64 bit

Original issue reported on code.google.com by nemof...@gmail.com on 22 May 2012 at 9:19

GoogleCodeExporter commented 8 years ago
Currently, rapidjson can only parse COMPLETE, valid json text. It does not 
support parsing in chunks.

By design, d.HasParseError() should be true after calling Parse() in your 
example.

Original comment by milo...@gmail.com on 22 May 2012 at 9:27