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

json_object_from_file cannot accept max_depth #139

Closed
minaguib opened this issue Jun 3, 2014 · 2 comments
Closed

json_object_from_file cannot accept max_depth #139

minaguib opened this issue Jun 3, 2014 · 2 comments

Comments

@minaguib
Copy link
Contributor

minaguib commented Jun 3, 2014

If I currently want to parse a json file while increasing the maximum nesting depth, I'm forced to either:

  • Patch JSON_TOKENER_DEFAULT_DEPTH at json-c compile time
  • Copy the entire body of json_object_from_file() into my own application , then adjust its internals to manually create a tokener with json_tokener_parse_ex(depth) and use it instead of the vanilla json_tokener_parse() used in it.

I propose, and if you agree, would be happy to submit a patch that:

  • Creates a new public function json_object_from_file_ex(const char filename, struct json_tokener tok, enum json_tokener_error *error) - this will have the bulk of the current json_object_from_file() code but will allow an external consumer to supply their own tokener as well as retrieve parsing error code
  • Update existing json_object_from_file(const char *filename) to be a very lightweight wrapper around the new json_object_from_file_ex() - maintaining 100% signature and behavior
@dota17
Copy link
Member

dota17 commented Jan 7, 2020

The public function json_object_from_file_ex() and corresponding testcase have been created in commit baed998. this issue and #166 could be closed. @hawicz

@hawicz
Copy link
Member

hawicz commented Jan 7, 2020

json_object_from_fd_ex() actually, but yes, let's close this now.

@hawicz hawicz closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants