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

Support UBJSON-derived Binary JData (BJData) format #3336

Merged
merged 51 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3c820dd
support UBJSON-derived Binary JData (BJData) format
fangq Feb 16, 2022
02d8f92
fix Codacy warning
fangq Feb 17, 2022
94b0268
partially fix VS compilation errors
fangq Feb 17, 2022
58efde8
fix additional VS errors
fangq Feb 17, 2022
76ee885
fix more VS compilation errors
fangq Feb 17, 2022
4985323
fix additional warnings and errors for clang and msvc
fangq Feb 17, 2022
55682ff
add more tests to cover the new bjdata types
fangq Feb 18, 2022
c8752b3
add tests for optimized ndarray, improve coverage, fix clang/gcc warn…
fangq Feb 18, 2022
42701cc
gcc warn useless conversion but msvc gives an error
fangq Feb 18, 2022
6fc7790
fix ci_test errors
fangq Feb 18, 2022
3d211b8
complete test coverage, fix ci_test errors
fangq Feb 19, 2022
5a485d5
add half precision error test
fangq Feb 19, 2022
9e72336
fix No newline at end of file error by clang
fangq Feb 19, 2022
408144a
simplify endian condition, format unit-bjdata
fangq Feb 19, 2022
122e9fc
remove broken test due to alloc limit
fangq Feb 19, 2022
e9d0f42
full coverage, I hope
fangq Feb 19, 2022
ed8c4c6
move bjdata new markers from default to the same level as ubjson markers
fangq Feb 20, 2022
d5e590e
fix ci errors, add tests for new bjdata switch structure
fangq Feb 21, 2022
29c7a43
make is_bjdata const after using initializer list
fangq Feb 21, 2022
53855c1
remove the unwanted assert
fangq Feb 21, 2022
7589b60
move is_bjdata to an optional param to write_ubjson
fangq Feb 21, 2022
8dd4a61
pass use_bjdata via output adapter
fangq Feb 21, 2022
8083430
revert order to avoid msvc 2015 unreferenced formal param error
fangq Feb 21, 2022
4615c4b
update BJData Spect V1 Draft-2 URL after spec release
fangq Feb 22, 2022
ee9e078
amalgamate code
fangq Feb 22, 2022
6b9da3b
code polishing following @gregmarr's feedback
fangq Feb 22, 2022
45a7c36
make use_bjdata a non-default parameter
fangq Feb 22, 2022
be6cdaa
fix ci error, remove unwanted param comment
fangq Feb 23, 2022
069b4d6
encode and decode bjdata ndarray in jdata annotations, enable roundtr…
fangq Feb 27, 2022
4c9dd31
partially fix ci errors, add tests to improve coverage
fangq Feb 27, 2022
5786991
polish patch to remove ci errors
fangq Feb 28, 2022
b54f058
fix a ndarray dim vector condition
fangq Feb 28, 2022
09ab236
fix clang tidy error
fangq Feb 28, 2022
8c2153c
add sax test cases for ndarray
fangq Mar 1, 2022
a7088b2
add additional sax event tests
fangq Mar 1, 2022
d4bdedc
adjust sax event numbering
fangq Mar 1, 2022
f38a67e
fix sax tests
fangq Mar 1, 2022
e7ae719
ndarray can only be used with array containers, discard if used in ob…
fangq Mar 2, 2022
7901839
complete test coverage
fangq Mar 2, 2022
2dc8f97
disable [{SHTFNZ in optimized type due to security risks in #2793 and…
fangq Mar 2, 2022
3593671
fix ci error
fangq Mar 2, 2022
f3ec3be
move OutputIsLittleEndian from tparam to param to replace use_bjdata
fangq Mar 13, 2022
a3c4218
fix ci clang gcc error
fangq Mar 14, 2022
33004bb
fix ci static analysis error
fangq Mar 15, 2022
0cf14ae
update json_test_data to 3.1.0, enable file-based bjdata unit tests
fangq Apr 3, 2022
f7db6c0
fix stack overflow error on msvc 2019 and 2022
fangq Apr 6, 2022
f7f1cd8
use https link, update sax_parse_error after rebase
fangq Apr 23, 2022
fd2eb29
make input_format const and use initializer
fangq Mar 13, 2022
05adfcc
return bool for write_bjdata_ndarray
fangq Apr 23, 2022
bc2f11d
test write_bjdata_ndarray return value as boolean
fangq Apr 23, 2022
f6ceebc
fix ci error
fangq Apr 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- [Implicit conversions](#implicit-conversions)
- [Conversions to/from arbitrary types](#arbitrary-types-conversions)
- [Specializing enum conversion](#specializing-enum-conversion)
- [Binary formats (BSON, CBOR, MessagePack, and UBJSON)](#binary-formats-bson-cbor-messagepack-and-ubjson)
- [Binary formats (BSON, CBOR, MessagePack, UBJSON, and BJData)](#binary-formats-bson-cbor-messagepack-ubjson-and-bjdata)
- [Supported compilers](#supported-compilers)
- [Integration](#integration)
- [CMake](#cmake)
Expand Down Expand Up @@ -961,9 +961,9 @@ Other Important points:
- When using `get<ENUM_TYPE>()`, undefined JSON values will default to the first pair specified in your map. Select this default pair carefully.
- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON.

### Binary formats (BSON, CBOR, MessagePack, and UBJSON)
### Binary formats (BSON, CBOR, MessagePack, UBJSON, and BJData)

Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](https://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), and [UBJSON](https://ubjson.org) (Universal Binary JSON Specification) to efficiently encode JSON values to byte vectors and to decode such vectors.
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](https://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), [UBJSON](https://ubjson.org) (Universal Binary JSON Specification) and [BJData](https://neurojson.org/bjdata) (Binary JData) to efficiently encode JSON values to byte vectors and to decode such vectors.

```cpp
// create a JSON value
Expand Down
2 changes: 1 addition & 1 deletion cmake/ci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ add_custom_target(ci_infer

add_custom_target(ci_offline_testdata
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data
COMMAND cd ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data && ${GIT_TOOL} clone -c advice.detachedHead=false --branch v3.0.0 https://github.com/nlohmann/json_test_data.git --quiet --depth 1
COMMAND cd ${PROJECT_BINARY_DIR}/build_offline_testdata/test_data && ${GIT_TOOL} clone -c advice.detachedHead=false --branch v3.1.0 https://github.com/nlohmann/json_test_data.git --quiet --depth 1
COMMAND ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja
-DJSON_BuildTests=ON -DJSON_FastTests=ON -DJSON_TestDataDirectory=${PROJECT_BINARY_DIR}/build_offline_testdata/test_data/json_test_data
Expand Down
2 changes: 1 addition & 1 deletion cmake/download_test_data.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
set(JSON_TEST_DATA_VERSION 3.0.0)
set(JSON_TEST_DATA_VERSION 3.1.0)

# if variable is set, use test data from given directory rather than downloading them
if(JSON_TestDataDirectory)
Expand Down
Loading