From: "jacknagel (Jack Nagel)" Date: 2013-08-08T07:51:55+09:00 Subject: [ruby-core:56439] [ruby-trunk - Bug #8742] JSON.parse can not handle tab in string Issue #8742 has been updated by jacknagel (Jack Nagel). I don't think literal tabs are allowed in strings, per the JSON spec. ---------------------------------------- Bug #8742: JSON.parse can not handle tab in string https://bugs.ruby-lang.org/issues/8742#change-40978 Author: joejack (Joe Jack) Status: Open Priority: Low Assignee: Category: lib Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [x86_64-linux] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN The following JSON file: ---- { "I am tab": " " } ---- does not parse when running the script: ---- require 'json' JSON.parse IO::read 'tab.json' ---- the error message is: ---- /usr/local/lib/ruby/1.9.1/json/common.rb:148:in `parse': 743: unexpected token at '{ (JSON::ParserError) "I am tab": " " } ' from /usr/local/lib/ruby/1.9.1/json/common.rb:148:in `parse' from parse.rb:2:in `
' ---- Taking out the quoted tab solves the problem. If there is a quoted tab in a file, the error message shows the entire document! -- http://bugs.ruby-lang.org/ _______________________________________________ ruby-core mailing list ruby-core@ruby-lang.org http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-core