View Issue Details

IDProjectCategoryView StatusLast Update
0009210Multi Theft Auto : San AndreasScriptingpublic2018-02-21 00:20
Reporterjohnflower Assigned Toqaisjp  
Status resolvedResolutionfixed 
Fixed in Version1.5.3 
Summary0009210: Pretty JSON

json-c has the option to prettify JSON output. Is there any reason why toJSON doesn't have an argument for this?

TagsNo tags attached.



2016-04-07 05:38

administrator   ~~0024591


see it in action:

if that change works fine (it shouldn't break any old scripts) then I'll add it clientside as well


2016-04-07 06:37

viewer   ~~0024592

Can we make pretty more pretty? imo, including JSON_C_TO_STRING_PRETTY_TAB and JSON_C_TO_STRING_SPACED would make it the prettiest thing.


2016-04-07 16:32

administrator   ~~0024593

Last edited: 2016-04-07 17:24

JSON_C_TO_STRING_PRETTY_TAB is in the json-c github code but not in the latest release. If json-c isn't modified in mtasa-blue then I'll look into updating it (when a new version of json-c is released) so that you can get pretty_tab.

I'll look into combining in JSON_C_TO_STRING_SPACED


2016-04-07 18:35

administrator   ~~0024594

Here you are:

Tested using:
No gif this time, sorry.


2016-04-07 21:42

administrator   ~~0024595

git log --name-status vendor/json-c/ shows a looot of modifications...

I manually added in the "tabs" argument for you:

let me know what you think about the Lua side of things and if it can be improved.


2016-04-07 22:49

administrator   ~~0024596

Comparing against json-c-0.12 from
should reveal our modifications


2016-04-08 04:28

viewer   ~~0024597

wrt lua usage: there's one thing... toJSON(tab, true, 'tabs') has spaces, while toJSON(tab, false, 'tabs') doesn't have spaces. This should be the other way round (i.e. true should remove the spaces and false should include them). Example:


2016-04-08 12:01

administrator   ~~0024598

thank you

fixed in


2016-06-06 01:46

viewer   ~~0024750

Can we have this added client side too?


2016-06-06 01:49

administrator   ~~0024751

Yes, sorry. I'll try to get around to it sometime this week.


2016-06-06 01:50

viewer   ~~0024752

Awesome. Thanks~


2016-06-19 00:53

administrator   ~~0024825

Last edited: 2016-06-19 00:56

Sorry the late commit - I have exams this month.

added in

Let me know if you need anything else.

Issue History

Date Modified Username Field Change