Page 1 of 1

[Func] JSON-like (de)serializer (AHK-L)

Posted: 30 Sep 2013, 10:53
by VxE
This package includes two functions:
JSON_FromObj takes an object and returns a string that expresses the object's contents.
JSON_ToObj takes a JSON-formatted string and returns an object containing the structured data it represents.

                AHK-Lib-JSON.zip

                Also on GitHub

The serializer does not conform exactly to the official JSON standard (see http://www.json.org). See the included README for details.

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 30 Sep 2013, 20:17
by joedf
Cool!

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 01 Oct 2013, 11:15
by Alibaba
VxE wrote:The serializer does not conform exactly to the official JSON standard (see http://www.json.org). See the included README for details.
So the generated json strings aren't useable in php scripts?

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 01 Oct 2013, 11:48
by VxE
Alibaba wrote:So the generated json strings aren't useable in php scripts?
I'm not sure what you mean... I don't know what php considers "usable".

That disclaimer is there because I was annoyed at all of the other JSON libraries that claim (either directly or implicitly) to completely conform to the standard, when they do not.

The major points of non-conformance in my "stringify" function are:
  • Numbers with an exponent (e.g: 123e+45) are treated as strings. The JSON standard sees them as numbers.
    Hexadecimal numbers are treated as numbers. The JSON standard sees them as strings.

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 01 Oct 2013, 11:56
by Alibaba
Ok, this are very little differences to the standard, i don't think they mind.

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 31 Jan 2014, 08:23
by maestrith
Very nice functions VxE :) What exactly is required to use your code as far as the copyright? Can I use it in my scripts? Can I edit the code?

Re: [Func] JSON-like (de)serializer (AHK-L)

Posted: 02 Feb 2014, 13:16
by VxE
You have permission to use the code in any manner you see fit, as long as you meet the conditions of the license, which basically says you must include the copyright notice and license text with any distributions that include the function code.

It's a very loose license.