Friday, Nov 17 2006
no comments
First there was the great news JSON being subset of YAML. Great as it allows you to use Ruby's YAML(Syck) parser to load JSON fragments, first step to Javascript-Ruby cross processing nirvana. Then sadly it turns out that whitespace ruins the party unless using a YAML safe outputter. Good news is that you can still munge JSON into YAML with a simple translation:
Technorati tags: YAML, JSON, Ruby, Javascript
YAML.load(unsafe_json.gsub(/,"(\w+)"/, ', "\1"').gsub(/"(\w+)":/, '"\1": '))
Technorati tags: YAML, JSON, Ruby, Javascript
Bits and pieces about Me glued together by Me!
links
SuprTags
archives
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005




Comments