G33kDude / cJson.ahk

AutoHotkey JSON library using embedded C for high performance
https://www.autohotkey.com/boards/viewtopic.php?f=6&p=408453
MIT License
80 stars 8 forks source link

AHK to JSON example fix #3

Closed burque505 closed 1 year ago

burque505 commented 2 years ago

This is hardly a big deal. As it stands, the example reads:

#Include <JSON>

; Create an object with every supported data type
obj := ["abc", 123, {"true": true, "false": false, "null": ""}, [cJson.true, cJson.false, cJson.null]]

; Convert to JSON
MsgBox, % JSON.Dump(obj) ; Expect: ["abc", 123, {"false": 0, "null": "", "true": 1}, [true, false, null]]

This doesn't give the expected results, as it's now 'JSON' instead of 'cJson'. Here's what results:

["abc", 123, {"false": 0, "null": "", "true": 1}, ["", "", ""]]

I would suggest changing the example to:

#Include <JSON>

; Create an object with every supported data type
obj := ["abc", 123, {"true": true, "false": false, "null": ""}, [JSON.true, JSON.false, JSON.null]]

; Convert to JSON
MsgBox, % JSON.Dump(obj) ; Expect: ["abc", 123, {"false": 0, "null": "", "true": 1}, [true, false, null]]

Thanks very much for this, very useful!

G33kDude commented 1 year ago

Fixed by 3351546743e7e376191a9ec49d9645afd6d7a453