diff --git a/platform-independent/c/core/src/mpw-marshal-util.c b/platform-independent/c/core/src/mpw-marshal-util.c index 77c820c5..4da45eb5 100644 --- a/platform-independent/c/core/src/mpw-marshal-util.c +++ b/platform-independent/c/core/src/mpw-marshal-util.c @@ -46,7 +46,7 @@ time_t mpw_mktime( tm.tm_year -= 1900; // tm_year 0 = rfc3339 year 1900 tm.tm_mon -= 1; // tm_mon 0 = rfc3339 month 1 - // mktime interprets tm as local & writes TZ to tm_gmtoff; offset its result back to UTC. + // mktime converts tm to local, setting tm_gmtoff; use it to offset the result back to UTC. return mktime( &tm ) + tm.tm_gmtoff; } diff --git a/platform-independent/c/core/src/mpw-marshal.c b/platform-independent/c/core/src/mpw-marshal.c index 0e0f8359..cee7c948 100644 --- a/platform-independent/c/core/src/mpw-marshal.c +++ b/platform-independent/c/core/src/mpw-marshal.c @@ -331,14 +331,16 @@ static bool mpw_marshal_write_json( } json_object *json_site_mpw = json_object_new_object(); - json_object_object_add( json_site, "_ext_mpw", json_site_mpw ); if (site->url) json_object_object_add( json_site_mpw, "url", json_object_new_string( site->url ) ); + if (json_object_object_length( json_site_mpw )) + json_object_object_add( json_site, "_ext_mpw", json_site_mpw ); mpw_free_strings( &content, &loginContent, NULL ); } - mpw_string_pushf( out, "%s\n", json_object_to_json_string_ext( json_file, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED ) ); + mpw_string_pushf( out, "%s\n", json_object_to_json_string_ext( json_file, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_NOSLASHESCAPE ) ); mpw_free( &masterKey, MPMasterKeySize ); json_object_put( json_file );