-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Demonstrative Example #572
Conversation
Signed-off-by: Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
Signed-off-by: Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
weird previously CI is fail with this errors |
Probably an issue on GitHub Actions. It should fix itself! |
@@ -6,6 +6,42 @@ standards such as [JSON Schema](http://json-schema.org), [JSON | |||
Pointer](https://www.rfc-editor.org/rfc/rfc6901), | |||
[JSONL](https://jsonlines.org), and more. | |||
|
|||
Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this, mainly if its not really a title. Maybe just end the above paragraph with "For example:"?
// Updating the value of the name using JSON pointer | ||
sourcemeta::jsontoolkit::set(document, name_pointer, name_value); | ||
sourcemeta::jsontoolkit::prettify(document, std::cout); | ||
std::cout<<"\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::cout<<"\n"; | |
std::cout << "\n"; |
Be mindful of style!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 It's going to take me some time to develop such detailed styled practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We all went through it :) Overall, attention to detail is super, super important in software engineering
std::cout<<"\n"; | ||
|
||
// The above program will print the following to standard output: | ||
//output : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no space between //
and output
here. In any case, I don't think you need to say "output :" here if the above sentence always says that the program will print the following to standard output
// The above program will print the following to standard output: | ||
//output : | ||
// { | ||
// "address": "zxy_with_bar", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is a mismatch between this and the actual example above
// A new JSON document for the name | ||
const sourcemeta::jsontoolkit::JSON name_value{"Johnny Doe"}; | ||
// Updating the value of the name using JSON pointer | ||
sourcemeta::jsontoolkit::set(document, name_pointer, name_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sourcemeta::jsontoolkit::set(document, name_pointer, name_value); | |
sourcemeta::jsontoolkit::set(document, {"name"}, new_value); |
I think inlining the JSON Pointer looks cooler from an example point of view
sourcemeta::jsontoolkit::parse(R"JSON({ | ||
"name": "John Doe", | ||
"age": 20, | ||
"address": "zxy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put a short semi-real address? I guess you can generate a supposedly valid i.e. US address on Google
sourcemeta::jsontoolkit::prettify(document, std::cout); | ||
std::cout<<"\n"; | ||
|
||
// The above program will print the following to standard output: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I see this again, I wonder if you should do this AFTER the code block. i.e. after showing the C++ program, write on the README: "The above program will print the following to standard output:", then open a new JSON code block, and put the output?
#include <iostream> | ||
|
||
int main() { | ||
// Creating JSON using parse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Creating JSON using parse | |
// Parsing a JSON document |
|
||
int main() { | ||
// Creating JSON using parse | ||
sourcemeta::jsontoolkit::JSON document = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the README we likely have more horizontal space, so you can format this a bit nicer:
sourcemeta::jsontoolkit::JSON document = sourcemeta::jsontoolkit::parse(R"JSON({
"name": "John Doe",
"age": 20,
"address": "zxy"
})JSON");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I do bad dreams because of this hahaha :)
@@ -22,3 +58,5 @@ long the outcome is distributed under the same license. Otherwise, you must | |||
obtain a [commercial license](./LICENSE-COMMERCIAL) that removes such | |||
restrictions. Read more about our licensing approach | |||
[here](https://www.sourcemeta.com/licensing/). | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank lines should go away
I imported your commits and fixed the remaining comments here: #845. Thanks! |
#336