diff --git a/API-Reference.md b/API-Reference.md index b4ee4b5..8326381 100644 --- a/API-Reference.md +++ b/API-Reference.md @@ -1,9 +1,27 @@ :construction: Work in progress, feel free to edit :construction: ## JsonArray -Create an empty JsonArray attached to the specified JsonBuffer. -You should not call this constructor directly. -Instead, use JsonBuffer::createArray() or JsonBuffer::parseArray(). + +Represents an array in a JSON object tree. + +### Constructor + +The constructor is private, you cannot instanciate a `JsonArray` directly, you have to use a `JsonBuffer`. + +Because the actual memory location of a `JsonArray` is in the `JsonBuffer`, you always manipulate them through reference and you cannot copy them. + +##### Example + +```c++ +StaticJsonBuffer<200> jsonBuffer; + +// create an empty array +JsonArray& array1 = jsonBuffer.createArray(); + +// parse a JSON array +char json[] = "[1,2,3]"; +JsonArray& array2 = jsonBuffer.parseArray(json); +``` ### JsonArray::add()