flatten and unflatten JSON extensions