Home Forum Support Jason / bash script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4577
    Urs Wirthmueller
    Participant

    I try to download via API using a bash script.

    The raw downloaded data using “https://data.uradmonitor.com/api/v1/devices/82000071/all/30” gives the following json data:

    [{“time”:”1499011173″,”latitude”:”46.94326000″,”longitude”:”7.47333500″,”altitude”:”565.00″,”temperature”:20.53,”pressure”
    :”95920″,”humidity”:68.62,”voc”:”80245″,”co2″:”431″,”ch2o”:”0.01″,”pm25″:”3″,”noise”:null,”cpm”:”22″,”voltage”:”383″,”duty
    “:”204”}]

    I noticed that “temperature” and “humidity” values appear without quotes (i.e.20.53 and 68.62) whereas all other fields have the values between quotes (i.e.”95920″ for “pressure”). What is the reason for this?

    #4807
    uRADMonitor
    Keymaster

    Yes, those two values are applied a calibration function and the return was numerical, while for the others the JSON encoder handled them as strings. Numbers don’t need the quotes, while other types do.

    While this has no impact on parsing (JSON with number in quotes is still valid), this has been fixed to drop quotes on all other numbers.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.