You are viewing a potentially older version of this package. View all versions.
JoStro-json5-0.1.1 icon

json5

Exposes a module for parsing json5 using lovely

Date uploaded 3 weeks ago
Version 0.1.1
Download link JoStro-json5-0.1.1.zip
Downloads 505
Dependency string JoStro-json5-0.1.1

This mod requires the following mods to function

Thunderstore-lovely-0.4.0 icon
Thunderstore-lovely

Lovely is a runtime lua injector for LÖVE 2d

Preferred version: 0.4.0

README

JSON5

Exposes a lua module for reading json5 via lovely

Usage

-- Require gives a function table
json5 = require "json5"

-- Return a json encoded string from a given value (also valid json5)
json5.encode({ "oh", {hello = "world"}}) -- Returns '["oh",{"hello":"world"}]'

-- Returns a value representing a given json5 string
json5.decode("[1,2,3,{hello: 'world',},]") -- Returns {1,2,3,{hello = "world"}}