jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Jackson JSON Processor
  • JACKSON-358

JsonParser: optional support for accepting leading zeroes for numbers

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.8.0
  • Component/s: JsonParser
  • Labels:
    None

Description

(from mailing list, by Bryce McKinlay)
—
The JSON spec disallows leading zeros in number values, for example:

"record":{ "serial":00001 }

However, since such leading zeros are permitted by Javascript and other, lazier JSON implementations, it is not uncommon to find examples of these in the wild.

This patch adds a Feature.ALLOW_NUMERIC_LEADING_ZEROS, which, when turned on, disables Jackson's checks for leading zeros, allowing such numbers to be parsed.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    jackson-leading-zeros.patch
    08/Sep/10 11:49 AM
    3 kB
    Tatu Saloranta

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Bryce McKinlay added a comment - 13/Jan/11 11:13 AM

Hello. It looks like my patch didn't make it into the Jackson 1.7 release. I would like to see this change committed as it would save me a little bit of work each time I update, but I'm sure there are others out there who would be helped by this, too.

Any chance of getting it in to the next version? Thanks!

Show
Bryce McKinlay added a comment - 13/Jan/11 11:13 AM Hello. It looks like my patch didn't make it into the Jackson 1.7 release. I would like to see this change committed as it would save me a little bit of work each time I update, but I'm sure there are others out there who would be helped by this, too. Any chance of getting it in to the next version? Thanks!
Hide
Permalink
Tatu Saloranta added a comment - 13/Jan/11 12:01 PM

Yeah, it was one of small number of things that were planned for inclusion but didn't make it. Part of this was significant internal refactorings. I will get it included in the next release (1.8.0).

Show
Tatu Saloranta added a comment - 13/Jan/11 12:01 PM Yeah, it was one of small number of things that were planned for inclusion but didn't make it. Part of this was significant internal refactorings. I will get it included in the next release (1.8.0).
Hide
Permalink
Tatu Saloranta added a comment - 18/Feb/11 6:14 PM

Sorry it took this long; the reason is that I wanted to ensure this also works correctly with respect to magnitude (i.e. leading zeroes do not change determination of int vs long), so patch is bit more complex.
But it now should work as expected, will be in 1.8.0.

I also noticed that 1.7.0 accidentally actually allows leading zeroes in some cases (with byte-based UTF-8 parser), which was a minor bug.

Show
Tatu Saloranta added a comment - 18/Feb/11 6:14 PM Sorry it took this long; the reason is that I wanted to ensure this also works correctly with respect to magnitude (i.e. leading zeroes do not change determination of int vs long), so patch is bit more complex. But it now should work as expected, will be in 1.8.0. I also noticed that 1.7.0 accidentally actually allows leading zeroes in some cases (with byte-based UTF-8 parser), which was a minor bug.

People

  • Assignee:
    Tatu Saloranta
    Reporter:
    Tatu Saloranta
Vote (0)
Watch (0)

Dates

  • Created:
    08/Sep/10 11:48 AM
    Updated:
    16/May/11 6:13 PM
    Resolved:
    18/Feb/11 6:14 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.