Git Product home page Git Product logo

lucifdch / json4lua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from craigmj/json4lua

0.0 2.0 0.0 111 KB

JSON (Javascript Object Notation - http://www.json.org) encoding / decoding module for Lua, and very basic JSON RPC module (requiring socket 2.0).Module requires compat-5.1 if using Lua 5.0.This repository was converted from a CVS repository on luaforge.net on Jan. 20, 2010.

Home Page: http://luaforge.net/projects/json

Lua 100.00%

json4lua's Introduction

json4lua

JSON and JSONRPC for Lua

Installation

luarocks install --server=http://rocks.moonscript.org/manifests/amrhassan --local json4Lua

JSON Usage

Encoding

json = require('json')
print(json.encode({ 1, 2, 'fred', {first='mars',second='venus',third='earth'} }))
[1,2,"fred", {"first":"mars","second":"venus","third","earth"}] 

Decoding

json = require("json")
testString = [[ { "one":1 , "two":2, "primes":[2,3,5,7] } ]]
decoded = json.decode(testString)
table.foreach(decoded, print)
print ("Primes are:")
table.foreach(o.primes,print)
one		1
two		2
primes		table: 0032B928
Primes are:
1		2
2		3
3		5
4		7

JSONRPC Usage

json = require('json')
require("json.rpc")
server = json.rpc.proxy("http://jsolait.net/testj.py")
result, error = server.echo('Test echo!')
print(result)
Test echo!

json4lua's People

Contributors

craigmj avatar soniex2 avatar amrhassan avatar danieljoos avatar luxoftakutsan avatar aoxu avatar exebetche avatar roadman avatar

Watchers

James Cloos avatar Lucifd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.