Serializes the recipe to a JSON string or file. All object classes are
stripped for clean serialization. The JSON format includes a schema version
tag ("1") and can be re-imported with recipe_import_json.
Value
If file is NULL, returns a JSON string (invisibly).
Otherwise writes to file and returns the file path invisibly.