mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
reference: JSON: try / catch for partial parsing
git-svn-id: svn://ultimatepp.org/upp/trunk@4145 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5a4547708d
commit
172f6a9d0d
1 changed files with 11 additions and 6 deletions
|
|
@ -24,13 +24,18 @@ CONSOLE_APP_MAIN
|
|||
String s = AsJSON(va);
|
||||
DUMP(s);
|
||||
CParser p2(s);
|
||||
p2.PassChar('[');
|
||||
if(!p2.Char(']')) {
|
||||
do {
|
||||
DUMP(ParseJSON(p2)["firstName"]);
|
||||
try {
|
||||
p2.PassChar('[');
|
||||
if(!p2.Char(']')) {
|
||||
do {
|
||||
DUMP(ParseJSON(p2)["firstName"]);
|
||||
}
|
||||
while(p2.Char(','));
|
||||
p2.PassChar(']');
|
||||
}
|
||||
while(p2.Char(','));
|
||||
p2.PassChar(']');
|
||||
}
|
||||
catch(CParser::Error) {
|
||||
LOG("invalid JSON");
|
||||
}
|
||||
|
||||
LOG("- Composing JSON using support classes");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue