system.util.jsonEncode output not the same in webdev module

After upgrading to ignition 8.3, something broke with the system.util.jsonEncode function.

If the call is made from the webdev module, some key-value pair will changes to dictionaries?

system.util.jsonEncode called from WebDev:

system.util.jsonEncode called from project script or message handler:

Webdev in 8.1 would generate the same output. (the desired output)

Am I missing something?

Thanks

What is the object you are encoding? Can you add some debug logging e.g. print type(value) before passing value to system.util.jsonEncode?

Sure can,

Type is dict:

Screenshot 2025-09-23 083441

here the code in webdev:

the output : is a key that contains an array.

each item in the array:

What's the type of the thing in a message handler? What are the contents of the dict? Can you compare them?

The behavior of jsonEncode doesn't change based on where you call it from. The only difference here can be that you are passing slightly different objects to it somehow.

the sendRequest sends back a list

this is the message handler:

the commented line, that what it was before I change to 8.3 to get my result.

now if I encode here, no problem.

modified webdev part, this gives me what 8.1 did.

What kinds of things are in the res list?

It seems that whatever they are, they might not be getting serialized/deserialized when returned by sendRequest the same was as in 8.1, or may be entirely different now.

replicated in simple projects

test_remoteGtw.zip (3.1 KB)

test_caller.zip (4.7 KB)

@paul-griffith do you recognize that dataType/value pair? Is this maybe some protobuf RPC thing?

remark: I did change from java serialization to protobuf in gateway settings.

On the gateway that handles the message, can you set this logger to TRACE:

metro.serializers.ServerMessageSerializer

Then run your test again and post the logger entry? It would help to see the response data just before it is Protobuf serialized.

Protobuf message header='[intent=_rpc:516692, iversion=0, codec=_js_, headers={{_headerid_=dfcf0ea3-951e-435e-b87b-896d0cbd6dd0, _source_=_0:0:Ignition-VMAPPP043, _ver_=2}}]', body='{ "@type": "type.googleapis.com/gateway.protobuf.SendRequestResultPB", "opId": { }, "pyResult": { "pyAsJson": { "pyClass": "org.python.core.PyList", "json": [{ "eventId": { "value": "1", "dataType": "java.lang.Integer" }, "recipes": [{ "eventId": { "value": "1", "dataType": "java.lang.Integer" }, "endDate": "2024-10-16 08:00:00.0", "recipe": "EPINETTE 2x3x8", "startDate": "2024-10-16 00:00:00.0" }], "counters": { "bundleOut": { "value": "64", "dataType": "java.lang.Integer" }, "sorterPieceCount": { "value": "36201", "dataType": "java.lang.Long" }, "bundleIn": { "value": "87", "dataType": "java.lang.Integer" }, "sorterPmp": 144120.0 }, "endDate": "2024-10-16 08:00:00", "oee": { "D": { "value": "0", "dataType": "java.lang.Integer" }, "OEE": { "value": "0", "dataType": "java.lang.Integer" }, "P": { "value": "0", "dataType": "java.lang.Integer" }, "Q": { "value": "0", "dataType": "java.lang.Integer" } }, "products": [{ "gradeName": "ECHAF", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1537", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "315", "dataType": "java.lang.Long" }, "pmp": 1260.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 ECHAF", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "37", "dataType": "java.lang.Long" } }, { "gradeName": "HT #4", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "7", "dataType": "java.lang.Integer" }, "code": { "value": "98", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "84000", "dataType": "java.lang.Long" }, "count": { "value": "586", "dataType": "java.lang.Long" }, "pmp": 2051.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x84 No4", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "5", "dataType": "java.lang.Long" } }, { "gradeName": "STUD HT", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "133", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "3380", "dataType": "java.lang.Long" }, "pmp": 13520.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 Stud", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "4", "dataType": "java.lang.Long" } }, { "gradeName": "NI 20", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1318", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "1499", "dataType": "java.lang.Long" }, "pmp": 5996.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 NI20", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "13", "dataType": "java.lang.Long" } }, { "gradeName": "HT #4", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "135", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "3465", "dataType": "java.lang.Long" }, "pmp": 13860.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 No4", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "5", "dataType": "java.lang.Long" } }, { "gradeName": "No2 HT", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "169", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "35", "dataType": "java.lang.Long" }, "pmp": 140.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 No2", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "2", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 1950", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "7", "dataType": "java.lang.Integer" }, "code": { "value": "1194", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "90000", "dataType": "java.lang.Long" }, "count": { "value": "334", "dataType": "java.lang.Long" }, "pmp": 1169.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x90 MSR1950", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "6", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 1950", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1163", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "11669", "dataType": "java.lang.Long" }, "pmp": 46676.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 MSR1950", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "6", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2100", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1165", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "4246", "dataType": "java.lang.Long" }, "pmp": 16984.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 MSR2100", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "8", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2400", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "496", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "7584", "dataType": "java.lang.Long" }, "pmp": 30336.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 MSR2400", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "9", "dataType": "java.lang.Long" } }, { "gradeName": "GRECON", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1168", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "3032", "dataType": "java.lang.Long" }, "pmp": 12128.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 Grecon", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "12", "dataType": "java.lang.Long" } }, { "code": { "value": "589", "dataType": "java.lang.Integer" }, "count": { "value": "56", "dataType": "java.lang.Long" }, "name": "NG/S" }], "bundles": [{ "productName": "2x3x96 Stud", "pieceCount": { "value": "532", "dataType": "java.lang.Long" }, "productCode": { "value": "133", "dataType": "java.lang.Long" }, "countFull": { "value": "5", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 NI20", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1318", "dataType": "java.lang.Long" }, "countFull": { "value": "2", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 No4", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "135", "dataType": "java.lang.Long" }, "countFull": { "value": "5", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 MSR1950", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1163", "dataType": "java.lang.Long" }, "countFull": { "value": "23", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 MSR2100", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1165", "dataType": "java.lang.Long" }, "countFull": { "value": "7", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 MSR2400", "pieceCount": { "value": "437", "dataType": "java.lang.Long" }, "productCode": { "value": "496", "dataType": "java.lang.Long" }, "countFull": { "value": "17", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 Grecon", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1168", "dataType": "java.lang.Long" }, "countFull": { "value": "5", "dataType": "java.lang.Integer" } }], "runTime": { "value": "28800", "dataType": "java.lang.Integer" }, "startDate": "2024-10-16 00:00:00", "energy": { "powerPeakDemand": { "value": "0", "dataType": "java.lang.Integer" }, "kWh": { "value": "0", "dataType": "java.lang.Integer" } } }, { "eventId": { "value": "2", "dataType": "java.lang.Integer" }, "recipes": [{ "eventId": { "value": "1", "dataType": "java.lang.Integer" }, "endDate": "2024-10-16 11:04:57.298", "recipe": "EPINETTE 2x3x8", "startDate": "2024-10-16 08:00:00.0" }, { "eventId": { "value": "2", "dataType": "java.lang.Integer" }, "endDate": "2024-10-16 16:00:00.0", "recipe": "EPINETTE 2x3x9", "startDate": "2024-10-16 11:04:57.298" }], "counters": { "bundleOut": { "value": "136", "dataType": "java.lang.Integer" }, "sorterPieceCount": { "value": "71821", "dataType": "java.lang.Long" }, "bundleIn": { "value": "175", "dataType": "java.lang.Integer" }, "sorterPmp": 303157.5 }, "endDate": "2024-10-16 16:00:00", "oee": { "D": { "value": "0", "dataType": "java.lang.Integer" }, "OEE": { "value": "0", "dataType": "java.lang.Integer" }, "P": { "value": "0", "dataType": "java.lang.Integer" }, "Q": { "value": "0", "dataType": "java.lang.Integer" } }, "products": [{ "gradeName": "ECHAF", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1537", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "452", "dataType": "java.lang.Long" }, "pmp": 1808.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 ECHAF", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "37", "dataType": "java.lang.Long" } }, { "gradeName": "HT #4", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "7", "dataType": "java.lang.Integer" }, "code": { "value": "98", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "84000", "dataType": "java.lang.Long" }, "count": { "value": "186", "dataType": "java.lang.Long" }, "pmp": 651.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x84 No4", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "5", "dataType": "java.lang.Long" } }, { "gradeName": "GRECON", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "1154", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "112000", "dataType": "java.lang.Long" }, "count": { "value": "415", "dataType": "java.lang.Long" }, "pmp": 1867.5, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x112 Grecon", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "12", "dataType": "java.lang.Long" } }, { "gradeName": "ECHAF", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "1539", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "107000", "dataType": "java.lang.Long" }, "count": { "value": "290", "dataType": "java.lang.Long" }, "pmp": 1305.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x107 ECHAF", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "37", "dataType": "java.lang.Long" } }, { "gradeName": "NI 20", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "1316", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "112000", "dataType": "java.lang.Long" }, "count": { "value": "2039", "dataType": "java.lang.Long" }, "pmp": 9175.5, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x112 NI20", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "13", "dataType": "java.lang.Long" } }, { "gradeName": "STUD HT", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "133", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "7819", "dataType": "java.lang.Long" }, "pmp": 31276.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 Stud", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "4", "dataType": "java.lang.Long" } }, { "gradeName": "NI 20", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1318", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "1402", "dataType": "java.lang.Long" }, "pmp": 5608.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 NI20", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "13", "dataType": "java.lang.Long" } }, { "gradeName": "HT #4", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "135", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "3219", "dataType": "java.lang.Long" }, "pmp": 12876.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 No4", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "5", "dataType": "java.lang.Long" } }, { "gradeName": "No2 HT", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "169", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "216", "dataType": "java.lang.Long" }, "pmp": 864.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 No2", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "2", "dataType": "java.lang.Long" } }, { "gradeName": "No3 HT", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1674", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "2290", "dataType": "java.lang.Long" }, "pmp": 9160.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 No3", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "135", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 1950", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "7", "dataType": "java.lang.Integer" }, "code": { "value": "1194", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "90000", "dataType": "java.lang.Long" }, "count": { "value": "212", "dataType": "java.lang.Long" }, "pmp": 742.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x90 MSR1950", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "6", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 1950", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1163", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "11237", "dataType": "java.lang.Long" }, "pmp": 44948.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 MSR1950", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "6", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2100", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1165", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "2773", "dataType": "java.lang.Long" }, "pmp": 11092.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 MSR2100", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "8", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2400", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "496", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "96000", "dataType": "java.lang.Long" }, "count": { "value": "6481", "dataType": "java.lang.Long" }, "pmp": 25924.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x96 MSR2400", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "9", "dataType": "java.lang.Long" } }, { "gradeName": "GRECON", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "8", "dataType": "java.lang.Integer" }, "code": { "value": "1168", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "101000", "dataType": "java.lang.Long" }, "count": { "value": "1913", "dataType": "java.lang.Long" }, "pmp": 7652.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x101 Grecon", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "12", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2400", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "500", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "109000", "dataType": "java.lang.Long" }, "count": { "value": "4302", "dataType": "java.lang.Long" }, "pmp": 19359.0, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x107 MSR2400", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "9", "dataType": "java.lang.Long" } }, { "gradeName": "GRECON", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "60", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "107000", "dataType": "java.lang.Long" }, "count": { "value": "2421", "dataType": "java.lang.Long" }, "pmp": 10894.5, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x107 Grecon", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "12", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 1950", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "1149", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "112000", "dataType": "java.lang.Long" }, "count": { "value": "17919", "dataType": "java.lang.Long" }, "pmp": 80635.5, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x112 MSR1950", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "6", "dataType": "java.lang.Long" } }, { "gradeName": "MSR 2100", "nominalThickness": { "value": "2", "dataType": "java.lang.Integer" }, "nominalLength": { "value": "9", "dataType": "java.lang.Integer" }, "code": { "value": "1151", "dataType": "java.lang.Long" }, "thickness": { "value": "1500", "dataType": "java.lang.Long" }, "length": { "value": "112000", "dataType": "java.lang.Long" }, "count": { "value": "6071", "dataType": "java.lang.Long" }, "pmp": 27319.5, "nominalWidth": { "value": "3", "dataType": "java.lang.Integer" }, "name": "2x3x112 MSR2100", "width": { "value": "2500", "dataType": "java.lang.Long" }, "gradeCode": { "value": "8", "dataType": "java.lang.Long" } }, { "code": { "value": "589", "dataType": "java.lang.Integer" }, "count": { "value": "164", "dataType": "java.lang.Long" }, "name": "NG/S" }], "bundles": [{ "productName": "2x3x96 ECHAF", "pieceCount": { "value": "437", "dataType": "java.lang.Long" }, "productCode": { "value": "1537", "dataType": "java.lang.Long" }, "countFull": { "value": "1", "dataType": "java.lang.Integer" } }, { "productName": "2x3x84 No4", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "98", "dataType": "java.lang.Long" }, "countFull": { "value": "1", "dataType": "java.lang.Integer" } }, { "productName": "2x3x112 NI20", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1316", "dataType": "java.lang.Long" }, "countFull": { "value": "3", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 Stud", "pieceCount": { "value": "532", "dataType": "java.lang.Long" }, "productCode": { "value": "133", "dataType": "java.lang.Long" }, "countFull": { "value": "14", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 NI20", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1318", "dataType": "java.lang.Long" }, "countFull": { "value": "3", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 No4", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "135", "dataType": "java.lang.Long" }, "countFull": { "value": "6", "dataType": "java.lang.Integer" } }, { "productName": "2x3x90 MSR1950", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1194", "dataType": "java.lang.Long" }, "countFull": { "value": "1", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 No3", "pieceCount": { "value": "532", "dataType": "java.lang.Long" }, "productCode": { "value": "1674", "dataType": "java.lang.Long" }, "countFull": { "value": "4", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 MSR1950", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1163", "dataType": "java.lang.Long" }, "countFull": { "value": "21", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 MSR2100", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1165", "dataType": "java.lang.Long" }, "countFull": { "value": "5", "dataType": "java.lang.Integer" } }, { "productName": "2x3x96 MSR2400", "pieceCount": { "value": "437", "dataType": "java.lang.Long" }, "productCode": { "value": "496", "dataType": "java.lang.Long" }, "countFull": { "value": "14", "dataType": "java.lang.Integer" } }, { "productName": "2x3x101 Grecon", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1168", "dataType": "java.lang.Long" }, "countFull": { "value": "3", "dataType": "java.lang.Integer" } }, { "productName": "2x3x107 MSR2400", "pieceCount": { "value": "437", "dataType": "java.lang.Long" }, "productCode": { "value": "500", "dataType": "java.lang.Long" }, "countFull": { "value": "10", "dataType": "java.lang.Integer" } }, { "productName": "2x3x107 Grecon", "pieceCount": { "value": "437", "dataType": "java.lang.Long" }, "productCode": { "value": "60", "dataType": "java.lang.Long" }, "countFull": { "value": "5", "dataType": "java.lang.Integer" } }, { "productName": "2x3x112 MSR1950", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1149", "dataType": "java.lang.Long" }, "countFull": { "value": "34", "dataType": "java.lang.Integer" } }, { "productName": "2x3x112 MSR2100", "pieceCount": { "value": "513", "dataType": "java.lang.Long" }, "productCode": { "value": "1151", "dataType": "java.lang.Long" }, "countFull": { "value": "11", "dataType": "java.lang.Integer" } }], "runTime": { "value": "16616", "dataType": "java.lang.Integer" }, "startDate": "2024-10-16 08:00:00", "energy": { "powerPeakDemand": { "value": "0", "dataType": "java.lang.Integer" }, "kWh": { "value": "0", "dataType": "java.lang.Integer" } } }] } } }'

maybe it would be esaier to use the test project I have uploaded in this thread (see up)

Ok we figured it out. It’s because the values are in a list, which is triggering a bug in one of the deserializers. I put in a ticket to get this fixed ASAP. Thanks for the simplified examples, they made this much easier to replicate.

4 Likes

Hi,

Version 8.3.1 fixed all the above but there is still something happening in the script console.

For example:

Webdev module, call a fonction on another gateway. Works fine, I get a result.

I have a script that call the same fonction, same parameters (for my example):

At the end, this sends a email

this gets call by a Scheduled script:

I do get my email, all si fine.

but if I call the same fonction in a script console (for debug purpose for example) and :

Java Traceback:
Traceback (most recent call last):
File "", line 1, in 
File "<module:AB2.PL03>", line 8, in csvProdRecipeDetails
at java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.SystemUtilities.sendRequest(SystemUtilities.java:827)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.inductiveautomation.ignition.common.rpc.proto.ProtoSerializationException: Unable to deserialize java.math.BigInteger; no deserializer found
at org.python.core.Py.JavaError(Py.java:545)
at org.python.core.Py.JavaError(Py.java:536)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:563)
at org.python.core.PyObject.__call__(PyObject.java:400)
at org.python.pycode._pyx164.csvProdRecipeDetails$1(<module:AB2.PL03>:73)
at org.python.pycode._pyx164.call_function(<module:AB2.PL03>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:119)
at org.python.core.PyFunction.__call__(PyFunction.java:406)
at org.python.pycode._pyx163.f$0(<input>:1)
at org.python.pycode._pyx163.call_function(<input>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1703)
at org.python.core.Py.exec(Py.java:1747)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:628)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:616)
at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: com.inductiveautomation.ignition.common.rpc.proto.ProtoSerializationException: Unable to deserialize java.math.BigInteger; no deserializer found
at java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.SystemUtilities.sendRequest(SystemUtilities.java:827)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
... 23 more
Caused by: com.inductiveautomation.ignition.common.rpc.proto.ProtoSerializationException: Unable to deserialize java.math.BigInteger; no deserializer found
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters.fallbackDeserializer(BuiltinAdapters.java:413)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.protoDecode(ProtoRpcSerializer.java:348)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:230)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:215)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.protoDecode(ProtoRpcSerializer.java:348)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$10.decode(BuiltinAdapters.java:277)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$10.decode(BuiltinAdapters.java:259)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.protoDecode(ProtoRpcSerializer.java:348)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:230)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:215)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.protoDecode(ProtoRpcSerializer.java:348)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$10.decode(BuiltinAdapters.java:277)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$10.decode(BuiltinAdapters.java:259)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.protoDecode(ProtoRpcSerializer.java:348)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:230)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters$8.decode(BuiltinAdapters.java:215)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:246)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeValue(ProtoRpcSerializer.java:234)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.decodeRpcMessage(ProtoRpcSerializer.java:220)
at com.inductiveautomation.ignition.common.rpc.proto.ProtoRpcSerializer.readReturnValue(ProtoRpcSerializer.java:387)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:347)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayConnection$Rpc$RpcInvocationHandler.invoke(GatewayConnection.java:335)
at jdk.proxy2/jdk.proxy2.$Proxy20.dispatchRequest(Unknown Source)
at com.inductiveautomation.ignition.client.script.DesignerSystemUtilities.lambda$sendRequestInternal$7(DesignerSystemUtilities.java:276)
at com.inductiveautomation.ignition.client.util.gui.progress.Task.lambda$create$1(Task.java:87)
at com.inductiveautomation.ignition.client.util.gui.progress.Task$FunctionWrapper.apply(Task.java:247)
at com.inductiveautomation.ignition.client.util.gui.progress.Task$FunctionWrapper.apply(Task.java:237)
at com.inductiveautomation.ignition.client.util.gui.progress.Task.lambda$runInternal$3(Task.java:205)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
... 3 more
Caused by: com.inductiveautomation.ignition.common.gson.JsonSyntaxException: Failed parsing '44133.0' as BigInteger; at path $
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapters$17.read(TypeAdapters.java:458)
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapters$17.read(TypeAdapters.java:448)
at com.inductiveautomation.ignition.common.gson.Gson.fromJson(Gson.java:1227)
at com.inductiveautomation.ignition.common.gson.Gson.fromJson(Gson.java:1329)
at com.inductiveautomation.ignition.common.gson.Gson.fromJson(Gson.java:1271)
at com.inductiveautomation.ignition.common.rpc.proto.BuiltinAdapters.fallbackDeserializer(BuiltinAdapters.java:410)
... 42 more
Caused by: java.lang.NumberFormatException: For input string: "44133.0"
at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
at java.base/java.lang.Integer.parseInt(Unknown Source)
at java.base/java.math.BigInteger.<init>(Unknown Source)
at java.base/java.math.BigInteger.<init>(Unknown Source)
at com.inductiveautomation.ignition.common.gson.internal.bind.TypeAdapters$17.read(TypeAdapters.java:456)
... 47 more
Traceback (most recent call last):
File "", line 1, in 
File "<module:AB2.PL03>", line 8, in csvProdRecipeDetails
at java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.SystemUtilities.sendRequest(SystemUtilities.java:827)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.inductiveautomation.ignition.common.rpc.proto.ProtoSerializationException: Unable to deserialize java.math.BigInteger; no deserializer found

The script console is not gateway scope. Anything in your script that requires gateway scope will break.

You simply cannot debug such code from the designer script console. Sorry.

1 Like

Interesting. You're using sendRequest - can you share the rest of your code or at least the portion where you assemble a value to return from the function you're calling?

While this is true, I don't think it's relevant here. They're apparently implicitly calling sendRequest in this library function, and that's the call that's failing.

1 Like

Sure.

Message handler:

image

Function:

def getDetails(startDate, endDate):

output = []
lstRecipe = AB2.PL03.Recipe.listBetween(startDate, endDate)

for i in range(len(lstRecipe)):
	
	bundles = AB2.PL03.Sorter.getProdOutput_Bundle(system.date.parse(lstRecipe[i]['startDate']), system.date.parse(lstRecipe[i]['endDate']))
	products = AB2.PL03.Sorter.getProdOutput_McxPMP(system.date.parse(lstRecipe[i]['startDate']), system.date.parse(lstRecipe[i]['endDate']))

	objCnt = {}
	objCnt['bundleIn'] = util.historian.counters.std("[CHIBOUGAMAU]CCL/CHIBOUGAMAU/AB2/PLANEUR/DECANTEUR-01/EDGE/Pqt_OK_Decanteur", \
													 lstRecipe[i]['startDate'], lstRecipe[i]['endDate'])
	
	objCnt['bundleOut'] = bundles['bundleOut']
	objCnt['sorterPieceCount'] = products['sorterPieceCount']
	lstRecipe[i]['counters'] = objCnt

	objCalcTime = {}
	objCalcTime['Recipe.getProdOutput_Bundle'] = bundles['calcTime']
	objCalcTime['Recipe.getProdOutput_McxPMP'] = products['calcTime']
	lstRecipe[i]['calcTimes'] = objCalcTime
	
	lstRecipe[i]['bundles'] = bundles['bundles']
	lstRecipe[i]['products'] = products['products']
	
	lstRecipe[i]['energy'] = {"powerPeakDemand":0, "kWh" : 0}
	lstRecipe[i]['oee'] = {"D" : 0, "P": 0, "Q": 0, "OEE": 0}
	
	output.append(lstRecipe[i])

return output

Here is a response sample:

response.json (662 Bytes)

example

I do not know why in the stack trace shows the number has a float.

It should be an int.

We are breaking at this position in the response.

Can you share this function? (If you're more comfortable direct messaging me, that's fine too).

I'm asking because of this line:
output.append(lstRecipe[i])

I don't think there's any problem in the JSON you're ultimately assembling - the problem is somewhere in the Python dictionary structure to JSON conversion we're doing automatically.

Here is an example of the output of this function:

So basically, I get the list of the recipe ran that day. Add some data to each “eventId”.

When done, add result to output list.

After all compiled, return results (output)