By using AsyncPostFromString(param) i want to post some data , But for http post request i have to set parameter as string and i have parameter as below in AA format.
So i want to know that how i can convert my data in string format here? is there any function or by using concatination i should convert it? please share your views.
first = {"verifyAgentProfileRestRequest":{"isDevice":false,"soapRequest":{"contractAcceptanceMedium":"WEB"}},"searchCustomerProfileRestRequest":{"soapRequest":{"customerSearch":{"address":{"streetAddress1":"NTAwIEUgRnJhbmtsaW4gU3Q=","unitNumber":"NzY0Mg==","zipCode":"MjMyMTk="},"sessionId":""}}},"selectCustomerProfileRestRequest":{"soapRequest":{"sessionId":"","searchSelectionChoice":{}}},"queryBadDebtRestRequest":{"soapRequest":{"sessionId":"","firstName":null,"lastName":null,"emailAddress":null,"socialSecurityNumber":null,"telephoneNumber":null,"creditCheckConsent":false},"dateOfBirth":null}}
It may not work if there are types of values it doesn’t like:
7.20 FormatJson(json as Object, flags = 0 as Integer) as String
Formats an Associative Array as a JSON string.
Data types supported are booleans, integer and floating point numbers, strings, roArray, and roAssociativeArray objects.
An error will be returned if arrays/associative arrays are nested more than 256 levels deep.
If an error occurs an empty string will be returned.
Normally non-ASCII characters are escaped in the output string as “\uXXXX” where XXXX is the hexadecimal representation of the Unicode character value. If flags=1, non-ASCII characters are not escaped.
The main thing is all the values can only be Booleans, Integers, Floats, Strings, Arrays, and Associative Arrays. No Function names allowed for one thing, and perhaps other things as well. So maybe this approach won’t work in your case.
When I use it I don’t use the flag, just FormatJson(myThing), not sure how that flag works anyway.
You might try:
print "firststr Type is " type(firststr)
first = {"firstName":null,"lastName":null,"emailAddress":null,"socialSecurityNumber":null,"telephoneNumber":null,"creditCheckConsent":false},"dateOfBirth":null}}
The BrightScript associative array literal format isn’t compatible with an arbitrary JSON value.
For one thing, the assignment to first refers to null which is not an intrinsic BrightScript keyword.
You could do:
null = invalid
prior to assigning to first, to address that.
However, in the current firmware (6.2), BrightScript also doesn’t support quoting the key names, so it still won’t work.
“RokuKC” wrote:
However, in the current firmware (6.2), BrightScript also doesn’t support quoting the key names, so it still won’t work.
What-what? Am i hearing an enhancement of hash literals is coming?