Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
badade33
Unverified
Commit
badade33
authored
6 years ago
by
Kenton Varda
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #677 from RReverser/json-decode
Rewrite JSON decoding
parents
3d97775b
2d14ff20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
3 deletions
+4
-3
CONTRIBUTORS
CONTRIBUTORS
+1
-0
json-test.c++
c++/src/capnp/compat/json-test.c++
+0
-0
json.c++
c++/src/capnp/compat/json.c++
+0
-0
json.h
c++/src/capnp/compat/json.h
+3
-3
No files found.
CONTRIBUTORS
View file @
badade33
...
...
@@ -17,6 +17,7 @@ Harris Hancock <vortrab@gmail.com>: MSVC support
Branislav Katreniak <branislav.katreniak@digitalstrom.com>: JSON decode
Matthew Maurer <matthew.r.maurer@gmail.com>: Canonicalization Support
David Renshaw <david@sandstorm.io>: bugfixes and miscellaneous maintenance
Ingvar Stepanyan <me@rreverser.com> <ingvar@cloudflare.com>: Custom handlers for JSON decode
This file does not list people who maintain their own Cap'n Proto
implementations as separate projects. Those people are awesome too! :)
This diff is collapsed.
Click to expand it.
c++/src/capnp/compat/json-test.c++
View file @
badade33
This diff is collapsed.
Click to expand it.
c++/src/capnp/compat/json.c++
View file @
badade33
This diff is collapsed.
Click to expand it.
c++/src/capnp/compat/json.h
View file @
badade33
...
...
@@ -49,7 +49,7 @@ class JsonCodec {
// - 64-bit integers are encoded as strings, since JSON "numbers" are double-precision floating
// points which cannot store a 64-bit integer without losing data.
// - NaNs and infinite floating point numbers are not allowed by the JSON spec, and so are encoded
// as
null. This matches the behavior of `JSON.stringify` in at least Firefox and Chrome
.
// as
strings
.
// - Data is encoded as an array of numbers in the range [0,255]. You probably want to register
// a handler that does something better, like maybe base64 encoding, but there are a zillion
// different ways people do this.
...
...
@@ -220,8 +220,8 @@ private:
void
encodeField
(
StructSchema
::
Field
field
,
DynamicValue
::
Reader
input
,
JsonValue
::
Builder
output
)
const
;
void
decodeArray
(
List
<
JsonValue
>::
Reader
input
,
DynamicList
::
Builder
output
)
const
;
void
decodeObject
(
List
<
JsonValue
::
Field
>::
Reader
input
,
DynamicStruct
::
Builder
output
)
const
;
Orphan
<
DynamicList
>
decodeArray
(
List
<
JsonValue
>::
Reader
input
,
ListSchema
type
,
Orphanage
orphanage
)
const
;
void
decodeObject
(
JsonValue
::
Reader
input
,
StructSchema
type
,
Orphanage
orphanage
,
DynamicStruct
::
Builder
output
)
const
;
void
addTypeHandlerImpl
(
Type
type
,
HandlerBase
&
handler
);
void
addFieldHandlerImpl
(
StructSchema
::
Field
field
,
Type
type
,
HandlerBase
&
handler
);
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment