Frequently asked questions¶
I always get JsonWrongDataTypeException!
You are accessing the wrong data of a json object.
My guess is that you have just created a Json object without initializing it with some data.
The default data type for a Json is __NULL__
. If you want to add key-value-pairs, it must to be of type JSON
!
eg: Json myJson = JsonBlock();
If you want to create a json-array, it has to be of type ARRAY
!
eg: Json myJson = JsonArray();
Jsons have to be initialized!
I get linker errors!
Make sure that JasonPP.cpp
is in your compile list!
eg: g++ main.cpp JasonPP.cpp
XY does not work!
If something mysteriously doesn't work, make sure to tell the compiler exactly what you want by using the explicit syntax.
By explicit syntax i mean using function calls instead of overloads. For example Arr({JsonData(5), JsonData(6)})
instead of Arr({5, 6})
or
newArray.CloneFrom(existingArray)
instead of newArray = existingArray
.
This should solve most problems.
JasonPP reads my numbers wrong!
You most likely have a leading zero, like 025
instead of 25
.
This is intended behaviour. Numbers with leading zeros are not decimal, but octal numbers! A whole other number system. Just write 25
.
UTF-8/16 characters look broken in the console
That's because the windows console is an incapable piece of...
Not because of JasonPP.
If you want to see your UTF-8/16 characters, your best bet is to save them to a file using an u16ofstream (for UTF-16) and have a look at them there.
Why did you re-implement a few basic functions?
It depends on the function.
For some i just wanted to avoid having its header as a dependency, others did just not support the data type i needed.
Some others i've implemented optimized for a specific data type (for example Pow()
for integer-only exponents).