Skip to content

Basic support for JSON #10

Description

@nobugs-hare

We have to implement:

  • class JSON::Data, effectively a variant which is able to represent all the necessary JSON data types
    • internally, JSON::Data should (a) have one single buffer, AND (b) pointers which are "dual" (either to this single buffer or being an 'owning' pointer).
      • single buffer is created in non-empty constructor of JSON::Data, and in JSON::parse(). As the JSON::Data is modified, use of the single buffer reduces; the buffer is dropped as soon as there are no references to it.
      • this approach allows to avoid multiple allocations in an extremely common scenario of JSON::parse() with subsequent read-only
  • two JS-like functions: JSON::stringify(JSON::Data) - returning nodecpp::string, and JSON::parse(const nodecpp::string&), returning (compact) JSON::Data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions