simjson 1.2.1
Very simple JSON library for simstr
 
Loading...
Searching...
No Matches
json.h
1/*
2 * (c) Проект "SimJson", Александр Орефков orefkov@gmail.com
3 * ver. 1.0
4 * Классы для работы с JSON
5 * (c) Project "SimJson", Aleksandr Orefkov orefkov@gmail.com
6 * ver. 1.0
7 * Classes for working with JSON
8 */
9
10#pragma once
11#include <memory>
12#include <optional>
13#include <vector>
14#include <simstr/sstring.h>
15#include <cassert>
16#include <type_traits>
17#include <utility>
18
19#ifndef __has_declspec_attribute
20#define __has_declspec_attribute(x) 0
21#endif
22
23#ifdef SIMJSON_IN_SHARED
24 #if defined(_MSC_VER) || (defined(__clang__) && __has_declspec_attribute(dllexport))
25 #ifdef SIMJSON_EXPORT
26 #define SIMJSON_API __declspec(dllexport)
27 #else
28 #define SIMJSON_API __declspec(dllimport)
29 #endif
30 #elif (defined(__GNUC__) || defined(__GNUG__)) && defined(SIMSTR_EXPORT)
31 #define SIMJSON_API __attribute__((visibility("default")))
32 #else
33 #define SIMJSON_API
34 #endif
35#else
36 #define SIMJSON_API
37#endif
38
43namespace simjson {
44using namespace simstr;
45using namespace simstr::literals;
46
47class Json {
48public:
49 enum Type {
50 Undefined,
51 Null,
52 Boolean,
53 Text,
54 Integer,
55 Real,
56 Object,
57 Array
58 };
59 struct null_t {};
60 struct emptyString_t {};
61 struct emptyObject_t {};
62 struct emptyArray_t {};
63
64 inline static const null_t null;
65 inline static const emptyString_t emptyString;
66 inline static const emptyObject_t emptyObject;
67 inline static const emptyArray_t emptyArray;
68};
69
70enum class JsonParseResult {
71 Success,
72 Pending,
73 NoNeedMore,
74 Error,
75};
76
77struct StreamedJsonParserBase {
78
79 unsigned line_{};
80 unsigned col_{};
81
82protected:
83 int state_ {};
84 u16s currentUnicode_[2]{};
85 int idxUnicode_{};
86};
87
88namespace jt {
89
90template<typename K>
91using KeyType = StoreType<K, strhash<K>>;
92
93template<typename T, typename K>
94concept JsonType = std::is_integral_v<std::remove_cvref_t<T>> ||
95 std::is_floating_point_v<std::remove_cvref_t<T>> ||
96 std::is_constructible_v<sstring<K>, T>;
97
98template<typename T, typename K>
99concept JsonKeyType = std::convertible_to<T, simple_str<K>> ||
100 std::same_as<std::remove_cvref_t<T>, KeyType<K>>;
101
102template<typename T, typename K>
103concept JsonArraySource = requires(const T& t) {
104 { t.empty() } -> std::same_as<bool>;
105 { t.size() } -> std::same_as<size_t>;
106 { *t.begin() } -> JsonType<K>;
107 { *t.end() } -> JsonType<K>;
108};
109
110template<typename T, typename K>
111concept JsonObjectSource = requires(const T& t) {
112 { t.empty() } -> std::same_as<bool>;
113 { t.size() } -> std::same_as<size_t>;
114 { t.begin()->first } -> JsonKeyType<K>;
115 { t.end()->first } -> JsonKeyType<K>;
116 { t.begin()->second } -> JsonType<K>;
117 { t.end()->second } -> JsonType<K>;
118};
119
120} // namespace jt
121
128template<typename K>
129class JsonValueTempl : public Json {
130public:
131 using strType = sstring<K>;
132 using ssType = simple_str<K>;
133
134 using json_value = JsonValueTempl<K>;
135 using obj_type = hashStrMap<K, JsonValueTempl<K>>;
136 using arr_type = std::vector<JsonValueTempl<K>>;
137 using json_object = std::shared_ptr<obj_type>;
138 using json_array = std::shared_ptr<arr_type>;
139
142 JsonValueTempl() : type_(Undefined) {}
145 SIMJSON_API JsonValueTempl(const JsonValueTempl& other);
148 JsonValueTempl(JsonValueTempl&& other) noexcept {
149 type_ = other.type_;
150 switch (other.type_) {
151 case Json::Text:
152 new (&val_.text) strType(std::move(other.val_.text));
153 break;
154 case Json::Object:
155 new (&val_.object) json_object(std::move(other.val_.object));
156 break;
157 case Json::Array:
158 new (&val_.array) json_array(std::move(other.val_.array));
159 break;
160 default:
161 memcpy(&val_, &other.val_, sizeof(val_));
162 }
163 other.type_ = Undefined;
164 }
165
167 SIMJSON_API ~JsonValueTempl();
168
171 JsonValueTempl(int8_t v) : type_(Integer) { val_.integer = v; }
174 JsonValueTempl(int16_t v) : type_(Integer) { val_.integer = v; }
177 JsonValueTempl(int32_t v) : type_(Integer) { val_.integer = v; }
180 JsonValueTempl(int64_t v) : type_(Integer) { val_.integer = v; }
183 JsonValueTempl(bool v) : type_(Boolean) { val_.boolean = v; }
186 JsonValueTempl(double v) : type_(Real) { val_.real = v; }
187
190 JsonValueTempl(strType t) : type_(Text) {
191 new (&val_.text) strType(std::move(t));
192 }
193
195 JsonValueTempl(ssType t) : type_(Text) {
196 new (&val_.text) strType(t);
197 }
198
200 template<StrExprForType<K> A>
201 JsonValueTempl(const A& e) : type_(Text) {
202 new (&val_.text) strType(e);
203 }
204
206 template<typename T, size_t N = const_lit_for<K, T>::Count>
207 JsonValueTempl(T&& str) : type_(Text) {
208 new (&val_.text) strType(std::forward<T>(str));
209 }
210
212 JsonValueTempl(const null_t&) : type_(Null) {}
215 JsonValueTempl(const emptyString_t&) : type_(Text) { new (&val_.text) strType; }
218 JsonValueTempl(const emptyObject_t&) : type_(Object) {
219 new (&val_.object) json_object(std::make_shared<obj_type>());
220 }
221
223 JsonValueTempl(const emptyArray_t&) : type_(Array) {
224 new (&val_.array) json_array(std::make_shared<arr_type>());
225 }
226
228 SIMJSON_API JsonValueTempl(Type type);
229
230 struct KeyInit : std::pair<const jt::KeyType<K>, json_value> {
231 using base = std::pair<const jt::KeyType<K>, json_value>;
232 KeyInit(const jt::KeyType<K>& k, const json_value& v) : base(k, v){}
233 KeyInit(ssType k, const json_value& v) : base(obj_type::toStoreType(k), v){}
234 };
235 using ObjectInit = std::initializer_list<KeyInit>;
241 JsonValueTempl(ObjectInit&& init) : type_(Object) {
242 new (&val_.object) json_object(std::make_shared<obj_type>(std::move(reinterpret_cast<std::initializer_list<std::pair<const jt::KeyType<K>, json_value>>&>(init))));
243 }
244 using ArrayInit = std::initializer_list<json_value>;
250 JsonValueTempl(ArrayInit&& init) : type_(Array) {
251 new (&val_.array) json_array(std::make_shared<arr_type>(std::move(init)));
252 }
253
259 JsonValueTempl(jt::JsonArraySource<K> auto const& obj) : JsonValueTempl(emptyArray) {
260 if (!obj.empty()) {
261 auto& arr = *as_array();
262 arr.reserve(obj.size());
263 for (const auto& e : obj) {
264 arr.emplace_back(e);
265 }
266 }
267 }
268
274 JsonValueTempl(jt::JsonObjectSource<K> auto const& obj) : JsonValueTempl(emptyObject) {
275 if (!obj.empty()) {
276 auto& me = *as_object();
277 for (const auto& [f, s] : obj) {
278 me.emplace(f, s);
279 }
280 }
281 }
282
283 struct Clone {
284 const json_value& from;
285 };
294 SIMJSON_API JsonValueTempl(const Clone& clone);
297 Type type() const { return type_; }
300 json_value clone() const {
301 return Clone{*this};
302 }
303
304 // Проверка типов
305 // Type checking
306
309 bool is_undefined() const { return type_ == Undefined; };
312 bool is_null() const { return type_ == Null; };
315 bool is_boolean() const { return type_ == Boolean; }
318 bool is_integer() const { return type_ == Integer; }
321 bool is_real() const { return type_ == Real; }
324 bool is_text() const { return type_ == Text; }
327 bool is_array() const { return type_ == Array; }
330 bool is_object() const { return type_ == Object; }
331
332 // ----------------------------- Boolean -----------------------------------------------
333
338 bool as_boolean() const {
339 assert(type_ == Boolean);
340 return val_.boolean;
341 }
342
349 std::optional<bool> boolean() const {
350 if (type_ == Boolean) {
351 return val_.boolean;
352 }
353 return {};
354 }
355
357 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
358 bool boolean_or_throw(Args&&...args) const {
359 if (type_ == Boolean) {
360 return val_.boolean;
361 }
362 throw Exc(std::forward<Args>(args)...);
363 }
364
366 SIMJSON_API bool to_boolean() const;
367
368 // ---------------------------------------- Integer -------------------------------------
371 int64_t as_integer() const {
372 assert(type_ == Integer);
373 return val_.integer;
374 }
375
377 std::optional<int64_t> integer() const {
378 if (type_ == Integer) {
379 return val_.integer;
380 }
381 return {};
382 }
383
385 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
386 int64_t integer_or_throw(Args&&...args) const {
387 if (type_ == Integer) {
388 return val_.integer;
389 }
390 throw Exc(std::forward<Args>(args)...);
391 }
392
400 SIMJSON_API std::optional<int64_t> to_integer() const;
403 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
404 int64_t to_integer_or_throw(Args&&...args) const {
405 if (auto val = to_integer()) {
406 return *val;
407 }
408 throw Exc(std::forward<Args>(args)...);
409 }
410 // -------------------------------------- Real --------------------------------------------
413 double as_real() const {
414 assert(type_ == Real);
415 return val_.real;
416 }
417
419 std::optional<double> real() const {
420 if (type_ == Real) {
421 return val_.real;
422 }
423 return {};
424 }
425
427 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
428 double real_or_throw(Args&&...args) {
429 if (type_ == Real) {
430 return val_.real;
431 }
432 throw Exc(std::forward<Args>(args)...);
433 }
434
437 SIMJSON_API double to_real() const;
438 // --------------------------------------- Number -----------------------------
439 // В нашей реализации в отличии от чистого json числа могут быть int64_t или double.
440 // Поэтому добавим ещё логику для работы только с обоими вариантами чисел.
441 // In our implementation, unlike pure json, numbers can be int64_t or double.
442 // Therefore, let's add some more logic to work only with both variants of numbers.
443
446 std::optional<int64_t> number_int() const;
449 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
450 int64_t number_int_or_throw(Args&&...args) const {
451 if (auto val = number_int()) {
452 return *val;
453 }
454 throw Exc(std::forward<Args>(args)...);
455 }
456
458 SIMJSON_API std::optional<double> number_real() const;
461 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
462 double number_real_or_throw(Args&&...args) const {
463 if (auto val = number_real()) {
464 return *val;
465 }
466 throw Exc(std::forward<Args>(args)...);
467 }
468
469 // --------------------------------------- Text -----------------------------
470
473 const strType& as_text() const {
474 assert(type_ == Text);
475 return val_.text;
476 }
477
480 std::optional<strType> text() const {
481 if (type_ == Text) {
482 return val_.text;
483 }
484 return {};
485 }
486
488 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
489 const strType& text_or_throw(Args&&...args) const {
490 if (type_ == Text) {
491 return val_.text;
492 }
493 throw Exc(std::forward<Args>(args)...);
494 }
495
497 template<typename Exc, typename ... Args> requires (std::is_constructible_v<Exc, Args...>)
498 const strType& not_empty_text_or_throw(Args&&...args) const {
499 if (type_ == Text && !val_.text.template trimmed<ssType>().is_empty()) {
500 return val_.text;
501 }
502 throw Exc(std::forward<Args>(args)...);
503 }
504
507 SIMJSON_API strType to_text() const;
508
511 json_object& as_object() {
512 assert(type_ == Object);
513 return val_.object;
514 }
515
517 const json_object& as_object() const {
518 assert(type_ == Object);
519 return val_.object;
520 }
521
523 json_array& as_array() {
524 assert(type_ == Array);
525 return val_.array;
526 }
527
529 const json_array& as_array() const {
530 assert(type_ == Array);
531 return val_.array;
532 }
533
535 void swap(json_value& other) noexcept {
536 char tmp[sizeof(*this)];
537 memcpy(tmp, this, sizeof(*this));
538 memcpy((void*)this, &other, sizeof(*this));
539 memcpy((void*)&other, tmp, sizeof(*this));
540 }
541
544 JsonValueTempl& operator=(json_value t) noexcept {
545 swap(t);
546 return *this;
547 }
548
560 template<jt::JsonKeyType<K> T>
561 const json_value& at(T&& key) const {
562 if (type_ == Object) {
563 if (auto it = as_object()->find(std::forward<T>(key)); it != as_object()->end())
564 return it->second;
565 }
566 return UNDEFINED;
567 }
568
580 template<jt::JsonKeyType<K> T>
581 const json_value& operator[](T&& key) const {
582 return at(std::forward<T>(key));
583 }
584
604 template<jt::JsonKeyType<K> T, typename...Args>
605 const json_value& operator()(T&& key, Args&&...args) const {
606 const json_value& res = at(std::forward<T>(key));
607 if constexpr (sizeof...(Args) == 0) {
608 return res;
609 } else {
610 return res.is_undefined() ? res : res(std::forward<Args>(args)...);
611 }
612 }
613
627 template<jt::JsonKeyType<K> T>
628 json_value& operator[](T&& key) {
629 if (type_ != Object) {
630 assert(this != &UNDEFINED);
631 *this = emptyObject;
632 }
633 return as_object()->try_emplace(std::forward<T>(key)).first->second;
634 }
635
655 template<jt::JsonKeyType<K> Key, typename ... Args>
656 json_value& set(Key&& key, Args&& ... args) {
657 if (type_ != Object) {
658 assert(this != &UNDEFINED);
659 *this = emptyObject;
660 }
661 return as_object()->emplace(std::forward<Key>(key), std::forward<Args>(args)...).first->second;
662 }
663
665 const json_value& at(size_t idx) const {
666 if (type_ == Array) {
667 const auto& arr = *as_array();
668 if (idx < arr.size()) {
669 return arr[idx];
670 }
671 }
672 return UNDEFINED;
673 }
674
676 const json_value& operator[](size_t idx) const {
677 return at(idx);
678 }
679
693 json_value& operator[](size_t idx) {
694 if (type_ != Array) {
695 assert(this != &UNDEFINED);
696 *this = emptyArray;
697 }
698 auto& arr = *as_array();
699 if (idx == -1) {
700 idx = arr.size();
701 }
702 if (idx >= arr.size()) {
703 arr.resize(idx + 1);
704 }
705 return arr[idx];
706 }
707
709 size_t size() const {
710 if (type_ == Array) {
711 return as_array()->size();
712 } else if (type_ == Object) {
713 return as_object()->size();
714 }
715 return 0;
716 }
717
737 SIMJSON_API void merge(const json_value& other, bool replace = true, bool append_arrays = false);
752 static std::tuple<json_value, JsonParseResult, unsigned, unsigned> parse(ssType jsonString);
773 SIMJSON_API void store(lstring<K, 0, true>& stream, bool prettify = false, bool order_keys = false, K indent_symbol = ' ', unsigned indent_count = 2) const;
794 lstring<K, 0, true> store(bool prettify = false, bool order_keys = false, K indent_symbol = ' ', unsigned indent_count = 2) const {
795 lstring<K, 0, true> res;
796 store(res, prettify, order_keys, indent_symbol, indent_count);
797 return res;
798 }
799
800protected:
801 SIMJSON_API static const json_value UNDEFINED;
802
803 // Тип значения
804 Type type_;
805 // Хранимое значение
806 union Value {
807 Value() : boolean(false){}
808 ~Value(){}
809 bool boolean;
810 int64_t integer;
811 double real;
812 strType text;
813 json_object object;
814 json_array array;
815 } val_;
816};
817
826template<typename K>
827struct StreamedJsonParser : StreamedJsonParserBase {
828
829 JsonValueTempl<K> result_;
830
831 using strType = typename JsonValueTempl<K>::strType;
832 using ssType = typename JsonValueTempl<K>::ssType;
833
834 void reset() {
836 new (this) StreamedJsonParser<K>;
837 }
846 JsonParseResult parseAll(ssType text) {
847 return process<true, true>(text);
848 }
849
859 JsonParseResult processChunk(ssType chunk, bool last) {
860 return last ? process<false, true>(chunk) : process<false, false>(chunk);
861 }
862
863protected:
864
865 template<bool All, bool Last>
866 SIMJSON_API JsonParseResult process(ssType chunk);
867
868 static bool isWhiteSpace(K symbol) {
869 return symbol == ' ' || symbol == '\t' || symbol == '\n' || symbol == '\r';
870 }
871
872 strType getText();
873 bool processUnicode(K symbol);
874
875 template<bool Compound, int NewState, typename ... Args>
876 JsonValueTempl<K>* addValue(JsonValueTempl<K>* current, Args&& ... args);
877
878 JsonValueTempl<K>* popStack();
879
880 template<bool asInt, bool All>
881 JsonValueTempl<K>* addNumber(JsonValueTempl<K>* current);
882
883 const K* ptr_{};
884 const K* startProcess_ {};
885 std::vector<JsonValueTempl<K>*> stack_{&result_};
886 chunked_string_builder<K> text_{512};
887};
888
889template<typename K>
890std::tuple<JsonValueTempl<K>, JsonParseResult, unsigned, unsigned> JsonValueTempl<K>::parse(ssType jsonString) {
892 auto res = parser.parseAll(jsonString);
893 return {std::move(parser.result_), res, parser.line_, parser.col_};
894}
895
908
911#if defined (SIMJSON_EXPORT) || !defined (SIMJSON_IN_SHARED)
912template<typename K>
913inline SIMJSON_API const JsonValueTempl<K> JsonValueTempl<K>::UNDEFINED;
914#else
915#endif
916
925SIMJSON_API stringa get_file_content(stra filePath);
926
927} // namespace simjson
Класс для представления json значения.
Definition json.h:129
JsonValueTempl(const emptyString_t &)
Definition json.h:215
std::optional< int64_t > number_int() const
Definition json.cpp:319
bool is_array() const
Definition json.h:327
JsonValueTempl(const A &e)
Definition json.h:201
json_value & operator[](size_t idx)
Access an array element by index.
Definition json.h:693
JsonValueTempl(jt::JsonObjectSource< K > auto const &obj)
Constructor from any standard container with pairs containing a string key in first and a JSON value ...
Definition json.h:274
SIMJSON_API std::optional< double > number_real() const
Definition json.cpp:330
const json_value & operator[](size_t idx) const
Definition json.h:676
int64_t integer_or_throw(Args &&...args) const
Definition json.h:386
double number_real_or_throw(Args &&...args) const
Definition json.h:462
bool is_boolean() const
Definition json.h:315
JsonValueTempl(const emptyArray_t &)
Definition json.h:223
const json_array & as_array() const
Definition json.h:529
std::optional< bool > boolean() const
Get a boolean if a boolean is stored, or nothing.
Definition json.h:349
JsonValueTempl(double v)
Definition json.h:186
int64_t as_integer() const
Definition json.h:371
JsonValueTempl & operator=(json_value t) noexcept
Definition json.h:544
JsonValueTempl(ssType t)
Definition json.h:195
const json_value & at(T &&key) const
Access to a property of a constant object by key.
Definition json.h:561
std::optional< double > real() const
Definition json.h:419
bool is_integer() const
Definition json.h:318
bool as_boolean() const
Get the value as boolean. The debug version checks that the value is indeed boolean.
Definition json.h:338
double real_or_throw(Args &&...args)
Definition json.h:428
JsonValueTempl(const null_t &)
Definition json.h:212
JsonValueTempl()
Definition json.h:142
bool is_object() const
Definition json.h:330
lstring< K, 0, true > store(bool prettify=false, bool order_keys=false, K indent_symbol=' ', unsigned indent_count=2) const
Serialize a json value to a string.
Definition json.h:794
void swap(json_value &other) noexcept
Definition json.h:535
std::optional< strType > text() const
Definition json.h:480
SIMJSON_API ~JsonValueTempl()
Definition json.cpp:154
json_value & set(Key &&key, Args &&... args)
Setting the value of a json object property by key.
Definition json.h:656
JsonValueTempl(bool v)
Definition json.h:183
SIMJSON_API void store(lstring< K, 0, true > &stream, bool prettify=false, bool order_keys=false, K indent_symbol=' ', unsigned indent_count=2) const
Serialize json value to string.
Definition json.cpp:504
JsonValueTempl(int16_t v)
Definition json.h:174
JsonValueTempl(T &&str)
Definition json.h:207
SIMJSON_API JsonValueTempl(const JsonValueTempl &other)
Definition json.cpp:128
SIMJSON_API void merge(const json_value &other, bool replace=true, bool append_arrays=false)
Merge with other JSON.
Definition json.cpp:386
JsonValueTempl(strType t)
Definition json.h:190
JsonValueTempl(ObjectInit &&init)
Constructor from initializer to create json::object. JsonValue v = {{"key1"_h, 1},...
Definition json.h:241
const strType & not_empty_text_or_throw(Args &&...args) const
Definition json.h:498
json_value & operator[](T &&key)
Access to an object property by key.
Definition json.h:628
SIMJSON_API JsonValueTempl(const Clone &clone)
Clone constructor. In this case, "deep" copies are created for objects and arrays.
Definition json.cpp:197
SIMJSON_API bool to_boolean() const
Definition json.cpp:224
json_object & as_object()
Definition json.h:511
json_array & as_array()
Definition json.h:523
SIMJSON_API std::optional< int64_t > to_integer() const
Get the value converted to an integer or nothing. The logic is the same as in javascript 1 * val....
Definition json.cpp:252
JsonValueTempl(ArrayInit &&init)
Constructor from initializer to create json::array. JsonValue json = {"key1", 12, false,...
Definition json.h:250
const json_object & as_object() const
Definition json.h:517
JsonValueTempl(const emptyObject_t &)
Definition json.h:218
const json_value & operator()(T &&key, Args &&...args) const
Access to a property of a constant object by a set of keys.
Definition json.h:605
JsonValueTempl(int8_t v)
Definition json.h:171
SIMJSON_API strType to_text() const
Definition json.cpp:341
int64_t to_integer_or_throw(Args &&...args) const
Definition json.h:404
bool is_text() const
Definition json.h:324
std::optional< int64_t > integer() const
Definition json.h:377
bool is_undefined() const
Definition json.h:309
JsonValueTempl(int32_t v)
Definition json.h:177
const json_value & operator[](T &&key) const
Access to a property of a constant object by key.
Definition json.h:581
const strType & as_text() const
Definition json.h:473
JsonValueTempl(JsonValueTempl &&other) noexcept
Definition json.h:148
JsonValueTempl(int64_t v)
Definition json.h:180
json_value clone() const
Definition json.h:300
JsonValueTempl(jt::JsonArraySource< K > auto const &obj)
Constructor from any standard array container containing JSON values.
Definition json.h:259
const strType & text_or_throw(Args &&...args) const
Definition json.h:489
bool is_null() const
Definition json.h:312
static std::tuple< json_value, JsonParseResult, unsigned, unsigned > parse(ssType jsonString)
Parse text to json.
Definition json.h:890
SIMJSON_API JsonValueTempl(Type type)
Definition json.cpp:171
double as_real() const
Definition json.h:413
bool is_real() const
Definition json.h:321
bool boolean_or_throw(Args &&...args) const
Definition json.h:358
int64_t number_int_or_throw(Args &&...args) const
Definition json.h:450
SIMJSON_API double to_real() const
Definition json.cpp:299
size_t size() const
Definition json.h:709
Type type() const
Definition json.h:297
const json_value & at(size_t idx) const
Definition json.h:665
Library namespace.
Definition json.h:43
JsonValueTempl< u16s > JsonValueU
Definition json.h:904
JsonValueTempl< uws > JsonValueW
Definition json.h:901
SIMJSON_API stringa get_file_content(stra filePath)
Read the file into a line.
Definition json.cpp:1140
JsonValueTempl< u8s > JsonValue
Definition json.h:898
JsonValueTempl< u32s > JsonValueUU
Definition json.h:907
Parser for text in JsonValue. Allows you to parse JSON in chunks of text. For example,...
Definition json.h:827
JsonParseResult parseAll(ssType text)
Parse all the text in one go.
Definition json.h:846
JsonParseResult processChunk(ssType chunk, bool last)
Parse a piece of text.
Definition json.h:859