How do I get WebSocket.MessageText through JSON to array?

0 favourites
  • 2 posts
From the Asset Store
Array Editor
$1 USD
80% off
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello all,

    New guy here.

    I'm trying to get the output from websocket.messagetext into an array.

    I've tried a few different JSON plugins but cant quite get the right workflow.

    Any ideas are much appreciated.

    Thanks

    JG

    Right now I have this coming in from the Websocket connection using the rex_hash plugin. I just want to import the values into an array

    {

    "topic": "/stream/8da4a9b5-80e9-4f01-a672-c760df080bd3/presence",

    "payload": "[{\"timestamp\":1539874381,\"sourceId\":\"JGauduAP02\",\"trackingId\":\"MsAPGT\",\"rssi\":-84,\"proximity\":\"NEAR\",\"scanType\":\"BLE\",\"deviceAddress\":\"f3:c7:15:9b:49:f9\"}]",

    "qos": 0,

    "retain": false,

    "_msgid": "38e2e96e.73da76"

    }

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can't use standard "Array load from JSON" action here, because arrays and dictionaries in Construct require custom JSON format (header).

    That "JSON" object with a yellow icon on your screenshot - is it rex_hash object? In this case I believe you need to remove "Array load from JSON", and instead add a sub-event like this:

    JSON for each key -> Array push JSON.CurValue(JSON.CurKey)

    I never used this plugin, so I may be wrong.

    There is a sample capx on the plugin page, have you tried it?

    rexrainbow.github.io/C2RexDoc/plugins.md/rex_hash.html

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)