Skip to content

Commit

Permalink
Convert Json to CSV issue 2 #325
Browse files Browse the repository at this point in the history
  • Loading branch information
Cinchoo committed Nov 14, 2024
1 parent 64ca012 commit 6ec324f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ChoETL.NETStandard/ChoETL.NETStandard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageTags>ETL c# .NET CSV Xml JSON Flat</PackageTags>
<PackageReleaseNotes>.NET Standard version</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>1.2.1.67</Version>
<Version>1.2.1.68</Version>
<AssemblyName>ChoETL.Core</AssemblyName>
<RootNamespace>ChoETL</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down
8 changes: 7 additions & 1 deletion src/ChoETL/Common/Dynamic/ChoDynamicObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,9 @@ public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object

public dynamic Clone()
{
return new ChoDynamicObject(CloneDictionary(_kvpDict));
var dobj = new ChoDynamicObject(CloneDictionary(_kvpDict));
dobj.DynamicObjectName = _dynamicObjectName;
return dobj;
}

private IDictionary<string, object> CloneDictionary(IDictionary<string, object> dict)
Expand Down Expand Up @@ -761,6 +763,10 @@ private object CloneObject(object value)
{
if (value == null)
return null;
else if (value is ChoDynamicObject dobj)
{
return dobj.Clone();
}
else if (value is IDictionary)
return CloneDictionary(value as IDictionary);
else if (value is IDictionary<string, object>)
Expand Down
5 changes: 3 additions & 2 deletions src/ChoETL/Common/ExtensionMethods/ChoDictionaryEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public static IEnumerable<dynamic> FlattenBy(this IEnumerable dicts, params stri
{
return FlattenBy(dicts, fields, false);
}
public static IEnumerable<dynamic> FlattenBy(this IEnumerable dicts, string[] fields, bool turnOffSingularization)
public static IEnumerable<dynamic> FlattenBy(this IEnumerable dicts, string[] fields, bool turnOffSingularization,
bool ignoreDictionaryFieldPrefix = false, string valueNamePrefix = null)
{
var cache = dicts != null ? dicts.OfType<object>().ToArray() : null;
if (cache == null)
Expand All @@ -222,7 +223,7 @@ public static IEnumerable<dynamic> FlattenBy(this IEnumerable dicts, string[] fi
{
if (rec is IDictionary<string, object>)
{
foreach (var child in FlattenBy((IDictionary<string, object>)rec, fields, turnOffSingularization))
foreach (var child in FlattenBy((IDictionary<string, object>)rec, fields, turnOffSingularization, ignoreDictionaryFieldPrefix, valueNamePrefix))
yield return child;
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/ChoETL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1.67")]
[assembly: AssemblyFileVersion("1.2.1.67")]
[assembly: AssemblyVersion("1.2.1.68")]
[assembly: AssemblyFileVersion("1.2.1.68")]
//[assembly: ChoAssemblyBetaVersion("beta1")]

0 comments on commit 6ec324f

Please sign in to comment.