Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions File_Adapter/CRUD/Create/CreateJson.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
*

Check failure on line 4 in File_Adapter/CRUD/Create/CreateJson.cs

View check run for this annotation

BHoMBot-CI / copyright-compliance

File_Adapter/CRUD/Create/CreateJson.cs#L3-L4

Copyright message is invalid - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/HasValidCopyright
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
Expand Down Expand Up @@ -63,6 +63,8 @@

bool valueTypesFound = false;

int objCount = 0;

foreach (var obj in content)
{
if (obj == null)
Expand All @@ -83,6 +85,7 @@
}

allLines.Add(obj.ToJson());
objCount++;
}

if (valueTypesFound)
Expand All @@ -93,8 +96,10 @@
json = allLines.Aggregate((a, b) => a + "," + Environment.NewLine + b);

// Join all between square brackets to make a valid JSON array.
json = String.Join(Environment.NewLine, allLines);
json = "[" + json + "]";
//json = String.Join(Environment.NewLine, allLines);

if(objCount > 1)
json = "[" + json + "]";
}
else
{
Expand Down