Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for unquoted String Values #121

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Dec 28, 2018

  1. Added support for unquoted String Values

    I've found lately JSONs with unquoted String values (it seems to be called [relaxed json](http://www.relaxedjson.org/)), so I've updated the code to support those:
    
    In this version, if you set the setting `JsonOptions.AllowUnquotedKeys` to `True` it will also allow unquoted Strings. Unquoted Strings (in this version) end once we find a space, a coma, a "}" or a "]".
    
    Notice that this will capture the true/false/null/numbers as strings (not having the quotes to identify the strings, all are a potential Strings), so we check them afterwards and:
    - If `IsNumeric()` we convert the value back to number using `VBA.Val()`.
    - If  = "null" -> `Null`
    - If = "true" / "false" -> `True` / `False`
    
    **Next steps:** We should clarify the setting `JsonOptions.AllowUnquotedKeys` : (a) rename it to clarify it works for both key and values or (b) create a new setting to allow unquote key/values separately.
    asopenag committed Dec 28, 2018
    Configuration menu
    Copy the full SHA
    41b0def View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1 from asopenag/unquoted-strings

    Added support for unquoted String Values
    asopenag committed Dec 28, 2018
    Configuration menu
    Copy the full SHA
    3c68359 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2018

  1. IsNumeric() check must be before true/false

    If json_ParseValue gets converted to boolean, then it returns isNumeric() -> true, leading to errors (since then true/false get converted to 0 through VBA.Val().
    Now IsNumeric() check runs first, skipping that use case.
    asopenag committed Dec 31, 2018
    Configuration menu
    Copy the full SHA
    fa5d902 View commit details
    Browse the repository at this point in the history