From 5f280aa2600fec7e14b6025a0635778e6286b900 Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 5 Nov 2011 12:45:20 +0000 Subject: [PATCH] reference: JSON git-svn-id: svn://ultimatepp.org/upp/trunk@4129 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- reference/JSON/JSON.upp | 2 ++ reference/JSON/main.cpp | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/reference/JSON/JSON.upp b/reference/JSON/JSON.upp index 8e93a75d4..3486498dd 100644 --- a/reference/JSON/JSON.upp +++ b/reference/JSON/JSON.upp @@ -1,3 +1,5 @@ +description "Using U++ JSON support functions and classes\377"; + uses Core; diff --git a/reference/JSON/main.cpp b/reference/JSON/main.cpp index dcd499854..dd936c970 100644 --- a/reference/JSON/main.cpp +++ b/reference/JSON/main.cpp @@ -1,4 +1,6 @@ -#include "JSON.h" +#include "Core/Core.h" + +using namespace Upp; CONSOLE_APP_MAIN { @@ -30,4 +32,19 @@ CONSOLE_APP_MAIN while(p2.Char(',')); p2.PassChar(']'); } + + LOG("- Composing JSON using support classes"); + Json json; + json + ("firstName", "Andrew") + ("secondName", "Smith") + ("age", 28) + ("address", Json("streetAddress", "23 3rd Street")("city", "New York")) + ; + JsonArray pn; + pn << Json("type", "home")("number", "12312345") + << Json("type", "work")("number", "87126388"); + json("phoneNumber", pn); + DUMP(~json); + DUMP(AsJSON(ParseJSON(~json), true)); }