lua-json
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/lua-json package

1.0.1 • Public • Published

lua-json

Version

Convert Lua tables to and from JSON.

Install

yarn add lua-json

Usage

const { format, parse } = require('lua-json')

format({ x: 1 }) // 'return { x = 1 }'
parse('return { x = 1 }') // { x: 1 }

API

type Json = null | boolean | number | string | Json[] | { [_: string]: Json }

format(
  value: Json,
  options?: {
    eol: string = '\n',
    singleQuote: boolean = true,
    spaces: null | number | string = 2,
  }
): string

parse(value: string): Json

TODO

  • More formatting options à la prettier: printWidth (!), trailingComma, bracketSpacing.

/lua-json/

    Package Sidebar

    Install

    npm i lua-json

    Weekly Downloads

    489

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    6.33 kB

    Total Files

    4

    Last publish

    Collaborators

    • gakada