Updated API Reference (markdown)

domonetic
2015-11-17 10:37:06 -03:00
parent e55c79755a
commit 233467b6c1

@@ -245,8 +245,7 @@ array.printTo(Serial);
Returns the size (in bytes) of an array with n elements. Returns the size (in bytes) of an array with n elements.
Can be very handy to determine the size of a StaticJsonBuffer. Can be very handy to determine the size of a StaticJsonBuffer.
##### Signatures ##### Signatures
```c++
```
##### Arguments ##### Arguments
##### Return value ##### Return value
##### Example ##### Example
@@ -272,30 +271,81 @@ virtual ~JsonBuffer() {}
Allocates an empty JsonArray. Allocates an empty JsonArray.
Returns a reference to the new JsonArray or JsonArray::invalid() if the allocation fails. Returns a reference to the new JsonArray or JsonArray::invalid() if the allocation fails.
**Fixed size.**
```c++
StaticJsonBuffer<200> jsonBuffer;
```
**Returns the size (in bytes) of an object with n elements.**
**Can be very handy to determine the size of a StaticJsonBuffer.**
```c++
struct SensorData {
const char* name;
int time;
float value;
};
#define SENSORDATA_JSON_SIZE (**JSON_OBJECT_SIZE(3)**)
```
#### JsonBuffer::createArray() #### JsonBuffer::createArray()
##### Description ##### Description
Allocates an empty JsonArray.
##### Signatures ##### Signatures
##### Arguments ##### Arguments
##### Return value ##### Return value
Returns a reference to the new JsonArray or JsonArray::invalid() if the allocation fails.
##### Example ##### Example
```c++
```
#### JsonBuffer::createObject() #### JsonBuffer::createObject()
##### Description ##### Description
Allocates an empty JsonObject.
##### Signatures ##### Signatures
```c++
```
##### Arguments ##### Arguments
##### Return value ##### Return value
Returns a reference to the new JsonObject or JsonObject::invalid() if the allocation fails.
##### Example ##### Example
#### JsonBuffer::parseArray() #### JsonBuffer::parseArray()
##### Description ##### Description
Allocates and populate a JsonArray from a JSON string.
//
//
//
//
//
##### Signatures ##### Signatures
```c++
```
##### Arguments ##### Arguments
The First argument is a pointer to the JSON string, the memory must be writable because the parser will insert null-terminators and replace escaped chars.
The second argument set the nesting limit (see comment on )
Default value of nesting limit of parseArray() and parseObject().
DEFAULT_LIMIT:
The nesting limit is a contain on the level of nesting allowed in the JSON string.
If set to 0, only a flat array or objects can be parsed.
If set to 1, the object can contain nested arrays or objects but only 1 level deep.
And bigger values will allow more level of nesting.
The purpose of this feature is to prevent stack overflow that could lead to a security risk.
##### Return value ##### Return value
Returns a reference to the new JsonObject or JsonObject::invalid() if the allocation fails.
##### Example ##### Example
#### JsonBuffer::parseObject() #### JsonBuffer::parseObject()
##### Description ##### Description
##### Signatures ##### Signatures
```c++
```
##### Arguments ##### Arguments
##### Return value ##### Return value
##### Example ##### Example
@@ -303,6 +353,8 @@ Returns a reference to the new JsonArray or JsonArray::invalid() if the allocati
#### JsonBuffer::strdup() #### JsonBuffer::strdup()
##### Description ##### Description
##### Signatures ##### Signatures
```c++
```
##### Arguments ##### Arguments
##### Return value ##### Return value
##### Example ##### Example