Skip to content

Table serializer to JSON and custom dot notation for troubleshooting and table visualization.

Notifications You must be signed in to change notification settings

pygaiwan/lua-table-serialize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Small utility (and learning exercise) to visualize Lua tables in JSON or "dot" notion to represent how you can access values of a table.

my_pkg = require('json_serializer')

data = { a = 'a', b = 'b', c = {1, 2, 3}, d = { x1 = 'x1', x2 = 'x2' } }

print('JSON Notation\n')
print(my_pkg.to_json(data))
JSON Notation

{
  "b": "b",
  "c": [
    1,
    2,
    3
  ],
  "d": {
    "x1": "x1",
    "x2": "x2"
  },
  "a": "a"
}
my_pkg = require('json_serializer')

data = { a = 'a', b = 'b', c = {1, 2, 3}, d = { x1 = 'x1', x2 = 'x2' } }

print('dot Notation\n')
print(my_pkg.pprint(data, 'data'))
dot Notation

data.b = "b"
data.c.1 = 1
data.c.2 = 2
data.c.3 = 3
data.d.x1 = "x1"
data.d.x2 = "x2"
data.a = "a"

About

Table serializer to JSON and custom dot notation for troubleshooting and table visualization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages