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)); }