Skip to content

Cleanup of API for reading and writing #397

New issue

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

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

Already on GitHub? # to your account

Closed
jacobwilliams opened this issue Jun 2, 2019 · 4 comments
Closed

Cleanup of API for reading and writing #397

jacobwilliams opened this issue Jun 2, 2019 · 4 comments

Comments

@jacobwilliams
Copy link
Owner

I'm thinking of adding read and write generic procedures to replace (or that could be used in addition to) the various routines:

  • json_file:load_file
  • json_file:load_from_string
  • json_file:print_file
  • json_file:print_to_string
  • json_core:parse
  • json_core:print
  • json_core:print_to_string

Or also maybe also consider UDDTIO?

@zbeekman
Copy link
Contributor

zbeekman commented Jun 3, 2019

UDDTIO would be really nice.

@dongli
Copy link

dongli commented Jul 5, 2019

Why not just give users json_file and json_value objects, what is the meaning of json_core. I find difficulties to figure out the paradigm.

@jacobwilliams
Copy link
Owner Author

json_file is the high-level interface. json_core is a class with all the methods for manually manipulating the JSON pointer structures (this is available for use by the user if they want, and is also used internally by json_file).

@jacobwilliams
Copy link
Owner Author

jacobwilliams commented Jul 9, 2019

Perhaps the new API should be:

json_file.print          ! json_file_print_to_console (me                  )
                         ! json_file_print_to_unit    (me,           iunit )
                         ! json_file_print_to_filename(me, filename        )
json_file.load           ! json_file_load             (me, filename, unit  )
json_file.serialize      ! json_file_load_from_string (me, str             )
json_file.deserialize    ! json_file_print_to_string  (me, str             )

json_core.print          ! json_print_to_console (json,       p           )
                         ! json_print_to_unit    (json,       p, iunit    )
                         ! json_print_to_filename(json,       p, filename )
json_core.load           ! json_parse_file       (json, file, p, unit     )
json_core.serialize      ! json_parse_string     (json,       p, str      )
json_core.deserialize    ! json_value_to_string  (json,       p, str      )

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants