Skip to content
Open
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
23 changes: 17 additions & 6 deletions Assets/graphQl-client/Scripts/Core/GraphApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,32 @@ public async void CancelSubscription(ClientWebSocket cws, string socketId = "1")

#region Utility

private static string JsonToArgument(string jsonInput){
private static string JsonToArgument(string jsonInput)
{
char[] jsonChar = jsonInput.ToCharArray();
List<int> indexes = new List<int>();
bool insideString = false;
jsonChar[0] = ' ';
jsonChar[jsonChar.Length - 1] = ' ';
for (int i = 0; i < jsonChar.Length; i++){
if (jsonChar[i] == '\"'){
if (indexes.Count == 2)
indexes = new List<int>();

for (int i = 0; i < jsonChar.Length; i++)
{
if (jsonChar[i] == '\"')
{
insideString = !insideString;

if (insideString)
{
indexes.Clear();
}
indexes.Add(i);
}

if (jsonChar[i] == ':'){
if (jsonChar[i] == ':' && !insideString && indexes.Count == 2)
{
jsonChar[indexes[0]] = ' ';
jsonChar[indexes[1]] = ' ';
indexes.Clear();
}
}

Expand Down