| 393 | |
| 394 | |
| 395 | void JSONReader::ignoreObjectRest() { |
| 396 | UInt8 c; |
| 397 | UInt32 inner(0); |
| 398 | while (packet.available() && (inner || (c=packet.read8()) != '}')) { |
| 399 | |
| 400 | // skip string |
| 401 | if (c == '"') { |
| 402 | while (packet.available() && (c=packet.read8()) != '"') { |
| 403 | if (c== '\\') { |
| 404 | if (packet.available()==0) |
| 405 | break; |
| 406 | packet.next(); |
| 407 | } |
| 408 | } |
| 409 | if(packet.available()==0) { |
| 410 | packet.next(packet.available()); |
| 411 | ERROR("JSON malformed, marker \" end of text not found"); |
| 412 | return; |
| 413 | } |
| 414 | } else if (c == '{' || c == '[') { |
| 415 | ++inner; |
| 416 | } else if (c == ']' || c == '}') { |
| 417 | if (inner == 0) { |
| 418 | packet.next(packet.available()); |
| 419 | ERROR("JSON malformed, marker ", c, " without beginning"); |
| 420 | return; |
| 421 | } |
| 422 | --inner; |
| 423 | } |
| 424 | } |
| 425 | if (packet.available()==0) |
| 426 | ERROR("JSON malformed, marker } end of object not found"); |
| 427 | } |
| 428 | |
| 429 | } // namespace Mona |