mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-27 09:17:32 +02:00
35 lines
976 B
C++
35 lines
976 B
C++
// Copyright Benoit Blanchon 2014-2015
|
|
// MIT License
|
|
//
|
|
// Arduino JSON library
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
#include "../include/ArduinoJson/JsonBuffer.hpp"
|
|
|
|
#include "../include/ArduinoJson/Internals/JsonParser.hpp"
|
|
#include "../include/ArduinoJson/JsonArray.hpp"
|
|
#include "../include/ArduinoJson/JsonObject.hpp"
|
|
|
|
using namespace ArduinoJson;
|
|
using namespace ArduinoJson::Internals;
|
|
|
|
JsonArray &JsonBuffer::createArray() {
|
|
JsonArray *ptr = new (this) JsonArray(this);
|
|
return ptr ? *ptr : JsonArray::invalid();
|
|
}
|
|
|
|
JsonObject &JsonBuffer::createObject() {
|
|
JsonObject *ptr = new (this) JsonObject(this);
|
|
return ptr ? *ptr : JsonObject::invalid();
|
|
}
|
|
|
|
JsonArray &JsonBuffer::parseArray(char *json, uint8_t nestingLimit) {
|
|
JsonParser parser(this, json, nestingLimit);
|
|
return parser.parseArray();
|
|
}
|
|
|
|
JsonObject &JsonBuffer::parseObject(char *json, uint8_t nestingLimit) {
|
|
JsonParser parser(this, json, nestingLimit);
|
|
return parser.parseObject();
|
|
}
|