The test will again generate a lot of entities, and we will construct a JSON string from each. We then expect the string to include several field names and their correctly encoded values.
You might be wondering why we do not check if these fields are the only ones within the JSON string. This would be more cumbersome to test, and a JSON containing more fields than we specified won’t matter for the decoder because it will just ignore them.
We might be tempted to produce a JSON string manually (like in the other tests) and simply compare the generated one to it. This may lead to errors. Because JSON does not provide stable sorted attributes (fields), we might get false positives because the compared strings are semantically equal but formally different.