Click here to Skip to main content
15,884,007 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am using VB.net 2010.

I am trying to remove an element of a json array using the remove method. It breaks the json string every time and inserts \'s (escaping the data)
"{\r\n \"orderId\": 83418672,\r\ as seen in notepad
instead of the actual control characters (whitespaces) which would not be visible in notepad.

Why is it escaping the characters which is not used in VB and how can I fix it.


myjArray(i).remove also breaks it. And I also updated json to the latest version via NuGet.

I don't know how to attach images but here is a link
http://quickbooksintegration.net/downloads/JSonRemove.png[^]
and here is the code.

Here is the code
Dim MyJToken As JToken = JObject.Parse(pJSON)
Dim MyJToken As JToken = JObject.Parse(pJSON)
Dim myjArray As JArray = Nothing
myjArray = MyJToken("orders")
For i = myjArray.Count - 1 To 0 Step -1  '  Removing may change order
  MyJObjectOrder = myjArray(i)
  if ToBeRemoved() then
    If MyTesting Then
       File.WriteAllText(zTemp & "SSMergeB4_" & i & ".json", FunRC)
    End If
    'myjArray(i).Remove()  '  Removes from jArray and MyJToken
    MyJObjectOrder.Remove()  '  Removes from jArray and MyJToken breaks #5

    FunRC = MyJToken.ToString
    If MyTesting Then
       File.WriteAllText(zTemp & "SSMergeAft_" & i & ".json", FunRC)
    End If
  end if
next
Posted
Updated 4-Jul-15 8:23am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900