C — JSON
Due Friday, 17 September 2021, 11:59pm
Purpose to explore the JSON libraries of the chosen programming language; to deliver software as specified
Delivery You must deliver xjson and Tests/ in a directory called C in your repository. The two artifacts are specified in the Task and Tests sections below.
All auxiliary files must be put into a sub-directory called Other.
Task Develop xjson, a program that consumes a series of well-formed The word “well-formed” means that each element of the sequence satisfies the JSON grammar. JSON from STDIN and delivers an equally long series of JSON to STDOUT.
The series is arbitrarily long; the elements are separated from each other by white space (such as blank spaces, newlines, tabs; no funny Unicode white space).
At first glance, JSON is a simple notation for exchanging information among software systems. As it turns out, turning JSON information into internal data is a bit of a minefield.
type of JSON value
meaning of “reverse”
reverse the characters in a string
Number
object
reverse per field as appropriate
array
reverse the array and reverse per slot as appropriate
Boolean
null
To avoid JSON oddities, a String must not be empty, must consist of lowercase alphabetical characters ([a-z]), and must not exceed 10 characters. The word “valid” means that each element of the sequence satisfies this constraint. Your program may assume that all Strings are valid.
Tests Place three tests for xjson in the directory Tests/.
A test case Nothing else should be called a “test.” always consists of given inputs and expected outputs. For this course, a test consists of a pair of files: n-in.json, the input file, and n-out.json, the expected output file, where n is an integer between 1 and the specified number of tests.
Note Our test harness compares expected JSON and actual JSON via a JSON-equality predicate, so white space or ordering of fields in objects in the expected output file does not matter.