Git Product home page Git Product logo

json-next / json-next Goto Github PK

View Code? Open in Web Editor NEW
32.0 2.0 0.0 29 KB

json-next gem - read generation y / next generation json versions (HanSON, SON, JSONX/JSON11, etc.) with comments, unquoted keys, multi-line strings, trailing commas, optional commas, and more

License: Creative Commons Zero v1.0 Universal

Ruby 100.00%
hanson json json-next hson son jsonx jsonxi json11 json-extensions opendata

json-next's Issues

infinite loop when trying to convert JSONX with extra comma

I was parsing a JSON document that had an extra comma, and when trying to clean it up it produced an infinite loop and threw a format error.

input = " {\"foo\":\"bar\",,}"
JSONX.convert(input)

throws

!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<
!! format error: object literal - expected colon (:) - rest is >>}<<
!! format error: string literal - expected opening quote (") - rest is >>}<<```
endlessly.

warning: character class has duplicated range

Hi. I'd like to submit back a small modification to pattern.rb in the json/next gem.

When I was using JSONX.parse I kept getting this warning:

/var/lib/gems/2.3.0/gems/json-next-1.2.1/lib/json/next/parser/jsonx.rb: warning: character class has duplicated range
/var/lib/gems/2.3.0/gems/json-next-1.2.1/lib/json/next/parser/jsonx.rb:77: warning: character class has duplicated range

That warning is pointing out that in regular expressions, \w already covers _, so you don't need to have both in the pattern. Personally, it seems silly to make a whole warning about that - a little regex redundancy is hardly worth taking up anybody's time. But warnings can be annoying. I edited pattern.rb so that the three instances of this:

\\w_

are changed to just this:

\\w

That made the warning go away. Of course, I don't know if it will make other warnings or errors appear. But hopefully this can fix this small problem.

:-)
Miko

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.