CaptainAubrey
New Coder
I was given a job assessment quiz and I think it has a JSON related question on it by mistake as my work is in C, C++, assembler, and python. But it looks interesting so I want to try to solve it. Here is what it asks and I have provided a facsimile of the tuples.
Using a JSON library (be sure to identify which library you use), write a function that will
format a message with the following schema:
I have looked at some JSON intro sites and to me it looks more like a way to store data rather than format it. Maybe there is a formatting function in one of the libraries. As a start I assume I setup the data tuples, maybe like this?
I have no idea about schemas or library formatting functions. I am sure I can find websites about schemas but I have no clue about libraries or searching them.
So I have a few questions.
What is JSON, where do I find the libraries and search them?
Is there a schema lib?
Can the libraries be used with C or C++?
If you can answer any of my questions or offer some advice it would be much appreciated.
Using a JSON library (be sure to identify which library you use), write a function that will
format a message with the following schema:
Code:
Name Value/Format
Name string
DOB mm/dd/yyyy
Channel data array of 2
Shift enum
Rate float
The data should be passed to this function as a pointer to a structure. The resulting
string is also passed as a pointer to a buffer.
I have looked at some JSON intro sites and to me it looks more like a way to store data rather than format it. Maybe there is a formatting function in one of the libraries. As a start I assume I setup the data tuples, maybe like this?
Code:
{
"Name" : "Newbie"
"DOB" : {
"month" : 2,
"day" : 6,
"year" : 1954
}
"Channel data" :
[
{
"Shift" : 2,
"rate" : 75.00
},
{
"Shift" : 1,
"rate" : 15.00
},
]
}
So I have a few questions.
What is JSON, where do I find the libraries and search them?
Is there a schema lib?
Can the libraries be used with C or C++?
If you can answer any of my questions or offer some advice it would be much appreciated.