1

I want to fetch data that comes in JSON.

enter image description here Below is the message

{"metadata":{..."Records":"Speed;Time","Unit":"m/s;hr",
 "Tag_number":"CWZ;CWD"},
"data":{"Timestamp":"8/1/2019 3:35:50 PM",
"Data_Status":"Good","Speed":0.373,
"Time":0.366210938,"Temperature":23.4375,"ID":"000FFEA3DD"}}

I want value of Speed/Temperature/Time depending on what is in metadata Records. Here it is Speed and Time So I want the value of Speed and time that is that is speed=0.373 and time=0.3662

0

1 Answer 1

1

I test with a HTTP trigger function, the below is my code. If your message is in json format, you could just select the property you want without parsing it.

module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

var jsonContent = req.body;
context.res={
    body:"Speed:"+(jsonContent.data.Speed)+"\r\n"+"Time:"+(jsonContent.data.Time)
};
};

enter image description here

From this pic, you cold see the response result. Hope this could help you.

Sign up to request clarification or add additional context in comments.

1 Comment

@Deep Gopal Das, if this could help you, you could accept it as the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.