Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxiy01/tstl-json-lua
https://github.com/maxiy01/tstl-json-lua
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/maxiy01/tstl-json-lua
- Owner: maxiy01
- Created: 2021-12-09T11:06:29.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T11:06:32.000Z (about 3 years ago)
- Last Synced: 2024-01-27T06:00:42.413Z (11 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TSTL json.lua
Declarations for [json.lua](https://github.com/rxi/json.lua), A lightweight JSON library for Lua.
| Command | Description |
|-|-|
| `yarn add -D tstl-json-lua` | Install these declarations |
| `yarn add rxi/json.lua` | Install json.lua |Upon installation these declarations can be linked to a _tsconfig.json_ file.
```json
{
"compilerOptions": {
"types": [
"tstl-json-lua"
]
}
}
```And used within any _.ts_ file.
```ts
import * as json from "json";let s = json.encode({
n: 42,
s: "Hello world"
});print(json.decode(s));
```Make sure to append `";./node_modules/json.lua/?.lua"` to your `package.path` in a _conf.ts_ file (this is run first) to assist where Lua looks for modules.
```ts
package.path += ";./node_modules/json.lua/?.lua";
```Also you need to add `"typescript-to-lua/language-extensions"` to _tsconfig.json_ file.
```json
{
"compilerOptions": {
"types": [
"typescript-to-lua/language-extensions"
]
}
}
```