View Issue Details

IDProjectCategoryView StatusLast Update
0009210Multi Theft Auto : San AndreasScriptingpublic2018-02-21 00:20
ReporterjohnflowerAssigned Toqaisjp 
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version1.5.3 
Summary0009210: Pretty JSON
Description

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.

Activities

qaisjp

2016-04-07 05:38

administrator   ~~0024591

see https://github.com/multitheftauto/mtasa-blue/commit/5e778527c5b0d7c5b027a792e25ea8fdc925fad6

see it in action: https://i.imgur.com/5F9a8HH.gifv

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

johnflower

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.

qaisjp

2016-04-07 16:32

administrator   ~~0024593

Last edited: 2016-04-07 17:24

View 2 revisions

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

qaisjp

2016-04-07 18:35

administrator   ~~0024594

Here you are: https://github.com/multitheftauto/mtasa-blue/commit/9b34a0cf6055b74a4533e0bc78bb0fbe16fe53db

Tested using: http://pastebin.com/nDih64y0
No gif this time, sorry.

qaisjp

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:

https://github.com/multitheftauto/mtasa-blue/commit/e5b1c3f06594dd3a61522e8b9bea51dce40dcfc3

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

ccw

2016-04-07 22:49

administrator   ~~0024596

Comparing against json-c-0.12 from https://github.com/json-c/json-c/releases
should reveal our modifications

johnflower

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: http://sprunge.us/gHfc

qaisjp

2016-04-08 12:01

administrator   ~~0024598

thank you

fixed in https://github.com/multitheftauto/mtasa-blue/commit/f60f2f8b42bf53f548a4fcff68fe58180599e0fc

johnflower

2016-06-06 01:46

viewer   ~~0024750

Can we have this added client side too?

qaisjp

2016-06-06 01:49

administrator   ~~0024751

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

johnflower

2016-06-06 01:50

viewer   ~~0024752

Awesome. Thanks~

qaisjp

2016-06-19 00:53

administrator   ~~0024825

Last edited: 2016-06-19 00:56

View 2 revisions

Sorry the late commit - I have exams this month.

added in https://github.com/multitheftauto/mtasa-blue/commit/c7aa30a01f933a5aff42a390f0975b6c85eaa38c

Let me know if you need anything else.

Issue History

Date Modified Username Field Change