Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minijson
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
minijson
Commits
ef0fa33b
Commit
ef0fa33b
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
move specification to help
parent
90ff1df3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/index.rst
+1
-0
1 addition, 0 deletions
docs/index.rst
docs/specification.rst
+58
-53
58 additions, 53 deletions
docs/specification.rst
with
59 additions
and
53 deletions
docs/index.rst
+
1
−
0
View file @
ef0fa33b
...
@@ -11,6 +11,7 @@ Welcome to MiniJSON's documentation!
...
@@ -11,6 +11,7 @@ Welcome to MiniJSON's documentation!
:caption: Contents:
:caption: Contents:
usage
usage
specification
Indices and tables
Indices and tables
==================
==================
...
...
This diff is collapsed.
Click to expand it.
specification.
md
→
docs/
specification.
rst
+
58
−
53
View file @
ef0fa33b
MiniJSON specification
MiniJSON specification
======================
======================
MiniJSON is a binary encoding for a subset of JSON that:
MiniJSON is a binary encoding for a subset of JSON that:
*
has no keys longer than 255 bytes UTF-8
* has no keys longer than 255 bytes UTF-8
*
all keys are string
* all keys are string
MiniJSON is bigger endian.
All data is stored as bigger endian.
Type Value consists of:
By char I mean uint8.
By short I mean uint16.
*
unsigned char value
By int I mean uint32.
*
unsigned char
*
data
Type Value consists of:
*
If value's highest bit is turned on, then remains are a UTF-8 string
with len of (value & 0x7F)
* unsigned char value
*
If value's two highest bits are 0100 or 0101, then four lowest bits encode the number of elements,
* unsigned char * data
and the four highest bits encode type of the object:
*
0100 - a list
* If value's highest bit is turned on, then remains are a UTF-8 string
*
0101 - an object
with len of (value & 0x7F)
Standard representation for an object or list follows,
* If value's two highest bits are 0100 or 0101, then four lowest bits encode the number of elements,
sans the element count.
and the four highest bits encode type of the object:
*
If value is zero, then next character is the length of the string followed by the string
* 0100 - a list
*
If value is 1, then next data is signed int
* 0101 - an object
*
If value is 2, then next data is signed short
Standard representation for an object or list follows,
*
If value is 3, then next data is signed char
sans the element count.
*
If value is 4, then next data is unsigned int
* If value is zero, then next character is the length of the string followed by the string
*
If value is 5, then next data is unsigned short
* If value is 1, then next data is signed int
*
If value is 6, then next data is unsigned char
* If value is 2, then next data is signed short
*
If value is 7, then next data is number of elements of a list,
* If value is 3, then next data is signed char
follows by Value of each element
* If value is 4, then next data is unsigned int
*
If value is 8, the value is a NULL
* If value is 5, then next data is unsigned short
*
If value is 9, then next element is a IEEE single
* If value is 6, then next data is unsigned char
*
If value is 10, then next element is a IEEE double
* If value is 7, then next data is number of elements of a list,
*
If value is 11, then next element is amount of entries for
follows by Value of each element
an object, then there goes the length of the field name,
* If value is 8, the value is a NULL
followed by field name in UTF-8, and then goes the Value
* If value is 9, then next element is a IEEE single
of the element
* If value is 10, then next element is a IEEE double
*
If value is 12, then next data is unsigned int24
* If value is 11, then next element is amount of entries for
*
If value is 13, then next data is an unsigned short representing the count
an object, then there goes the length of the field name,
of characters, and then these characters follow and are
followed by field name in UTF-8, and then goes the Value
interpreted as a UTF-8 string
of the element
*
If value is 14, then next data is an unsigned int representing the count
* If value is 12, then next data is unsigned int24
of characters, and then these characters follow and are
* If value is 13, then next data is an unsigned short representing the count
*
If value is 15, then next data is a unsigned short,
of characters, and then these characters follow and are
and then a list follows of that many elements
interpreted as a UTF-8 string
*
If value is 16, then next data is a unsigned int,
* If value is 14, then next data is an unsigned int representing the count
and then a list follows of that many elements
of characters, and then these characters follow and are
*
If value is 17, then next data is a unsigned short,
interpreted as a UTF-8 string
and then an object follows of that many elements
* If value is 15, then next data is a unsigned short,
*
If value is 18, then next data is a unsigned int,
and then a list follows of that many elements
and then an object follows of that many elements
* If value is 16, then next data is a unsigned int,
and then a list follows of that many elements
* If value is 17, then next data is a unsigned short,
and then an object follows of that many elements
* If value is 18, then next data is a unsigned int,
and then an object follows of that many elements
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment