locked
JSON format issue in Routing RRS feed

  • Question

  • Hi,

    We are sending message through the device using Azure libraries and below is a sample message generated.

    When we try to create a route and provide the below JSON in the "Test the route" section , we get an error saying

    "The syntax of your device message is malformed."

    ANy idea on what is wrong as I have validated via online tools that below is a valid JSON format

    {
      "deviceId": "Feather HUZZAH ESP8266 WiFi",
      "messageId": 1,
      "temperature": 24,
      "humidity": 48,
      "EventProcessedUtcTime": "2018-08-06T12:11:36.7354282Z",
      "PartitionId": 0,
      "EventEnqueuedUtcTime": "2018-08-06T12:11:36.2980000Z",
      "IoTHub": {
        "MessageId": null,
        "CorrelationId": null,
        "ConnectionDeviceId": "Temperature",
        "ConnectionDeviceGenerationId": "636681197128878765",
        "EnqueuedTime": "2018-08-06T12:11:36.2040000Z",
        "StreamId": null
      }
    }

    Monday, August 6, 2018 4:09 PM

All replies

  • Hello Akash1.j

    The message you provided is an event read from custom endpoint Event Hub.

    An IoT Hub message consists of:

    • A set of system properties. Properties that IoT Hub interprets or sets. This set is predetermined.
    • A set of application properties. A dictionary of string properties that the application can define and access, without needing to deserialize the message body. IoT Hub never modifies these properties.
    • An opaque binary body.

    Reference Azure IoT Hub message format.

    The following is an example:

    {
      "message": {
        "systemProperties": {
          "contentType": "application/json",
          "contentEncoding": "utf-8",
          "iothub-message-source": "deviceMessages",
          "iothub-enqueuedtime": "2017-05-08T18:55:31.8514657Z"
        },
        "appProperties": {
          "processingPath": "<optional>",
          "verbose": "<optional>",
          "severity": "<optional>",
          "testDevice": "<optional>"
        },
        "body": "{\"Weather\":{\"Temperature\":50}}"
      }
    }

    What you need in a route is a D2C message has the above format.

    Please let me know if it works.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, August 7, 2018 1:56 AM
  • Thanks Rita,

    However, how I can see the exact message that my device is sending so that I am able to see the Application properties and system properties as well .

    Once I am able to see the message, I will be able to write the routing rule.

    Thanks,

    Akash Jain

    Tuesday, August 7, 2018 8:23 AM
  • Hello Akash1.j

    You can use Device Explorer on Windows. On other platforms use the iothub explorer tool.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 8, 2018 2:34 AM