pius / jsont

ruby implementation of http://goessner.net/articles/jsont/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsonT

Description

Implemtation of javascript JsonT transformation library. goessner.net/articles/jsont/ Conforms to most of the JsonT spec minus the javascript function ability. (Have to use Proc’s instead of javascript function)

Install

sudo gem install jsont

Usage

>> JsonT.new({'self' => '<div>{$.test}</div>', 'test' => '<p>{$.x} {$.y}</p>'}).transform('test' => {'x' => 1, 'y' => 2})
<< <div><p>1 2</p></div>

>> JsonT.new({'self' => '<div>{$.test}</div>', 'test' => Proc.new{|t, opts| t['x']+t['y']}}).transform('test' => {'x' => 1, 'y' => 2})
<< <div>3</div>

About

ruby implementation of http://goessner.net/articles/jsont/

License:GNU Lesser General Public License v3.0


Languages

Language:Ruby 100.0%