Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
JopStro committed May 6, 2024
1 parent 9c6fb17 commit 79812b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# JSON5 lua

A native lua module for reading json5, written in rust with mlua and serde.

## Usage
the json5.dll/dylib/so file must be availible in the lua cpath (e.g. the working directory)
```lua
-- 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"}}
```

0 comments on commit 79812b4

Please sign in to comment.