m2v2: new functions to serialize to JSON