Nightfirecat / RealmEye-API

An easy way to access your character data via RealmEye.
MIT License
13 stars 7 forks source link

Output proper JSON (no string-booleans), Standardize response types #43

Closed Nightfirecat closed 7 years ago

Nightfirecat commented 7 years ago

Rather than outputting "false" and "true", false and true should be used. (I believe this is due to historical issues of PHP's json_encode() not outputting correct values for booleans in previous versions)

In the process, I'd also like to see output see a more consistent schema: output types should be constant (no int/string responses, such as the chars and characters keys). This may require additional keys to represent certain states (profiles with characters hidden come to mind).

P.S. Unicode and forward slashes should also not be escaped; see the following to fix that:

Nightfirecat commented 7 years ago

For reference, the following is some expected output of test commands:

php > print(json_encode(Array('a'=>(1===1))));
{"a":true}
php > print(json_encode(Array('a'=>("1"==1))));
{"a":true}
php > print(json_encode(Array('a'=>("1"==2))));
{"a":false}