
Originally Posted by
jpbro
Code:
With po_Request.Http.QueryParameters
For ii = 0 To .KeyCount - 1
lo_Json.IJsonObject.AddJsonObjectByKeyValuePairs "Query" & ii+1, .KeyByIndex(ii), .ValuesByIndex(ii)
Next ii
End With
End Sub
I've just dived into your code for the first time - and am not really sure (yet), what the purpose of these special Add-Functions is,
but the JSON-standard requires (with regards to adding "new stuff"):
1) in case a JSON-Object is the target you want to add-to: a Key and a Value
2) in case a JSON-Array is the target you want to add-to: only a Value (and no Key)
Values can be "plain, Values" (like Strings, Doubles, Integers, Boolean and the null-value) -
but also "Node-Values" (either another JSON-Array, or another JSON-Object - both encapsulated by the cCollection-Type).
So in that special case above, an add-method would only have to do (instead of the looping):
Code:
lo_Json.IJsonObject.AddToObject "QueryParams", _
po_Request.Http.QueryParameters.Internal_cCollection_Clone
To put the whole Param-List in one single call into the "MotherObject" (target-Object) under the Key "QueryParams".
E.g. in case the target-object already contained two "plain-values" with the keys "FirstName" and "LastName" like that:
Code:
{
"FirstName": "Fred",
"LastName": "Flintstone"
}
Then after the "single-line-add-call" it would e.g. contain:
Code:
{
"FirstName": "Fred",
"LastName": "Flintstone",
"QueryParams":{
"URL":"Some/Url",
"HTTPS":true,
"etc":"pp"
}
}
Olaf