Giter VIP home page Giter VIP logo

luajson's Introduction

LuaJSON

JSON Parser/Constructor for Lua

Author:

Thomas Harning Jr. [email protected]

Source code:

http://repo.or.cz/luajson

Bug reports:

http://github.com/harningt/luajson [email protected]

Requirements

Lua 5.1, 5.2, 5.3, LuaJIT 2.0, or LuaJIT 2.1 LPeg (Tested with 0.7, 0.8, 0.9, 0.10, 0.12rc2, 1.0) For regressionTest: lfs (Tested with 1.6.3)

For lunit-tests:

lunitx >= 0.8

NOTE:

LPeg 0.11 may not work - it crashed during my initial tests, it is not in the test matrix.

Lua versions tested recently:

  • Lua 5.1.5
  • Lua 5.2.4
  • Lua 5.3.2
  • LuaJIT-2.0.4
  • LuaJIT-2.1.0-beta2

License

All-but tests: MIT-style, See LICENSE for details tests/*: Public Domain / MIT - whichever is least restrictive

Module/Function overview:

json.encode (callable module referencing json.encode.encode)

encode ( value : ANY-valid )

Takes in a JSON-encodable value and returns the JSON-encoded text Valid input types:

  • table
  • array-like table (spec below)
  • string
  • number
  • boolean
  • 'null' - represented by json.util.null

Table keys (string,number,boolean) are encoded as strings, others are erroneus Table values are any valid input-type Array-like tables are converted into JSON arrays... Position 1 maps to JSON Array position 0

isEncodable ( value : ANY )

Returns a boolean stating whether is is encodeable or not NOTE: Tables/arrays are not deeply inspected

json.decode (callable module referencing json.decode.decode)

decode (data : string, strict : optional boolean)

Takes in a string of JSON data and converts it into a Lua object If 'strict' is set, then the strict JSON rule-set is used

json.util

printValue (tab : ANY, name : string)

recursively prints out all object values - if duplicates found, reference printed

null

Reference value to represent 'null' in a well-defined way to allow for null values to be inserted into an array/table

merge (t : table, ... : tables)

Shallow-merges a sequence of tables onto table t by iterating over each using pairs and assigning.

Attribution

parsing test suite from JSON_checker project of http://www.json.org/ No listed license for these files in their package.

luajson's People

Contributors

agladysh avatar esmil avatar fperrad avatar giraugh avatar harningt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.