The class that was implemented can be used for bidirectional conversion between Item instances and a QByteArray object, which contains the object data in the JSON format. We didn't do any error checking here; instead, we relied on Qt's rule that an error results in a sensible default value.
What if you want to perform error checking? The most straightforward solution in this case is to use exceptions, as they will automatically propagate from the multiple nested calls to the caller's location. Ensure that you catch any exceptions you throw, or the application will terminate. A more Qt-like solution is to create a bool *ok argument in all methods (including internal ones) and set the boolean value to false in case of any ...