
User16445912622657480582 (Customer) asked a question.
Is there any way to make sure the order of the keys entered in an Object Construct card are followed. They appear construct the keys in a random order. Which is frustrating given that the keys in the command JSON for token manipulation MUST BE in correct order. Any help would be appreciated.

@User16445912622657480582 (Customer)
According to the JSON RFC there is no expectation of order.
https://www.rfc-editor.org/rfc/rfc8259
An object is an unordered collection of zero or more name/value
pairs, where a name is a string and a value is a string, number,
boolean, null, object, or array.
However, it looks like if properly formatted JSON text is passed into the JSON parse it will maintain the the passed in order (even though it is not required to).
Yep. The reason this came up is because https://developer.okta.com/docs/reference/token-hook/#sample-response-to-add-a-claim fails if the keys are not in a specific order.
It would be nice if it could maintain the order specified. The RFC says there should be no exception of order but not everyone follows the RFC to the letter. Okta customers do not have any control over how vendor systems handle JSON. This includes other aspects of the Okta platform.
@User16445912622657480582 (Customer) - From the link you provided it appears you are working with In-line hooks. These have a very short period of time for a response (I believe 3 seconds is the default). Are you sure you are not just exceeding this period which would result in failure?
Also, the example payload in the documentation doesn't give any indication that order would matter. It is structured in a way that the data can be accessed dynamically based on how JSON works with key:value pairs.
Do you have an example where you maintain the exact same structure and just change the object order at the correct level in the JSON and receive two different results?
Hey Tim,
I was mistaken. The order does not matter for inline token hooks. I did another test in an environment where I set a response using the text compose. This allowed me to set the payload in various key orders. I did not see any issue with any of them.
My original environment works. So many executions have happened that I have lost that original error in history. I must have fixed another issue will reordering the keys.
The execution times are 1 second and I see the lightning bolt icon on the flow execution history. So it does not appear to be a timing issue.
Thanks,
Skylar Smith