Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
dd04a329
Unverified
Commit
dd04a329
authored
Apr 13, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
fix bug in diff function #1983
parent
b7be613b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+1
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+1
-1
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+8
-0
No files found.
include/nlohmann/json.hpp
View file @
dd04a329
...
...
@@ -7930,7 +7930,7 @@ class basic_json
result
.
push_back
(
{
{
"op"
,
"add"
},
{
"path"
,
path
+
"/
"
+
std
::
to_string
(
i
)
},
{
"path"
,
path
+
"/
-"
},
{
"value"
,
target
[
i
]}
});
++
i
;
...
...
single_include/nlohmann/json.hpp
View file @
dd04a329
...
...
@@ -22741,7 +22741,7 @@ class basic_json
result
.
push_back
(
{
{
"op"
,
"add"
},
{
"path"
,
path
+
"/
"
+
std
::
to_string
(
i
)
},
{
"path"
,
path
+
"/
-"
},
{
"value"
,
target
[
i
]}
});
++
i
;
...
...
test/src/unit-regression.cpp
View file @
dd04a329
...
...
@@ -1896,6 +1896,14 @@ TEST_CASE("regression tests")
static_assert
(
!
std
::
is_constructible
<
json
,
std
::
tuple
<
NotSerializableData
,
std
::
string
>>::
value
,
""
);
static_assert
(
std
::
is_constructible
<
json
,
std
::
tuple
<
int
,
std
::
string
>>::
value
,
""
);
}
SECTION
(
"issue #1983 - JSON patch diff for op=add formation is not as per standard (RFC 6902)"
)
{
const
auto
source
=
R"({ "foo": [ "1", "2" ] })"
_json
;
const
auto
target
=
R"({"foo": [ "1", "2", "3" ]})"
_json
;
const
auto
result
=
json
::
diff
(
source
,
target
);
CHECK
(
result
.
dump
()
==
R"([{"op":"add","path":"/foo/-","value":"3"}])"
);
}
}
#if not defined(JSON_NOEXCEPTION)
...
...
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