Skip to content

Commit 644037b

Browse files
committed
added option to serialize Json formatted or not (#63)
1 parent 5ebfd73 commit 644037b

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

Synapse.Common/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
// by using the '*' as shown below:
3939
// [assembly: AssemblyVersion("1.0.*")]
4040
[assembly: AssemblyVersion( "0.1.0.0" )]
41-
[assembly: AssemblyFileVersion( "0.1.17155.0" )]
41+
[assembly: AssemblyFileVersion( "0.1.17166.0" )]

Synapse.Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
// by using the '*' as shown below:
3838
// [assembly: AssemblyVersion("1.0.*")]
3939
[assembly: AssemblyVersion( "0.1.0.0" )]
40-
[assembly: AssemblyFileVersion( "0.1.17155.0" )]
40+
[assembly: AssemblyFileVersion( "0.1.17166.0" )]

Synapse.Core/Utilities/YamlHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ public static void Serialize(TextWriter tw, object data, bool serializeAsJson =
2828
serializer.Serialize( tw, data );
2929
}
3030

31-
public static string Serialize(object data, bool serializeAsJson = false, bool emitDefaultValues = false)
31+
public static string Serialize(object data, bool serializeAsJson = false, bool formatJson = true, bool emitDefaultValues = false)
3232
{
3333
string result = null;
3434

3535
if( !string.IsNullOrWhiteSpace( data?.ToString() ) )
3636
using( StringWriter writer = new StringWriter() )
3737
{
3838
Serialize( writer, data, serializeAsJson, emitDefaultValues );
39-
result = serializeAsJson ? JsonHelpers.FormatJson( writer.ToString() ) : writer.ToString();
39+
result = serializeAsJson && formatJson ? JsonHelpers.FormatJson( writer.ToString() ) : writer.ToString();
4040
}
4141

4242
return result;
4343
}
4444

45-
public static void SerializeFile(string path, object data, bool serializeAsJson = false, bool emitDefaultValues = false)
45+
public static void SerializeFile(string path, object data, bool serializeAsJson = false, bool formatJson = true, bool emitDefaultValues = false)
4646
{
4747
if( !serializeAsJson )
4848
{
@@ -51,7 +51,7 @@ public static void SerializeFile(string path, object data, bool serializeAsJson
5151
}
5252
else //gets formatted json
5353
{
54-
string result = Serialize( data, serializeAsJson, emitDefaultValues );
54+
string result = Serialize( data, serializeAsJson, formatJson, emitDefaultValues );
5555
File.WriteAllText( path, result );
5656
}
5757
}

Synapse.cli/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion( "0.1.0.0" )]
36-
[assembly: AssemblyFileVersion( "0.1.17155.0" )]
36+
[assembly: AssemblyFileVersion( "0.1.17166.0" )]

0 commit comments

Comments
 (0)