Custom Property Object to JSON

I’m trying to pass a custom property object into a named query that calls a stored proc that is expecting a JSON string. When I do this in my scripting I get an error because there is extra text in the JSON string.

Here is an image of the custom property.

And here is an image of what the data looks like when I send it to the logger.

As you can see there is a lot of extra data in the string that isn’t displayed in the customer property. I’m wondering how best to get this data into a JSON string without the extra data.

That’s because the values are being turned into Qualified Values, which have a Value, Quality and Timestamp attached. To get JUST the value, you can use .value.

There’s documentation on Property Change Scripts that talks about getting just the value from a QV.

I tried wcgJSON.value and I get an error stating:
“###Fatal-Traceback (most recent call last): File “function:runAction”, line 19, in runAction AttributeError: ‘array.array’ object has no attribute ‘value’”.

I’m assuming there is an easy way to do this rather than go through each item in the parameter and building the JSON structure.

import json
custom_onj = {}
custom_obj.update([ (k, v.value) for k, v in self.custom.wcgJSON] )
my_json = json.dumps(custom_obj)
# SQL stuff here

Something like this should work, although I make no promises for the syntax.