Categories
Mastering Development

How to remove quotes for json keys in json string using regex in jq

Trying to convert json payload to graphql and having some troubles. I need to convert string like "{ \"entity\":{ \"id\":\"7fbe7e65-0f01-4934-a2a9-dcc6d81a5b95\", \"type\":\"Products\", \"status\":\"pending\", \"services\":[ { \"id\":\"1e05737e-754b-4d19-b872-5a0135d99cf4\", \"type\":\"Services\", \"status\":\"active\" },{ \"id\":\"2238fe75-3d1a-4768-8464-be7d48037215\", \"type\":\"Services\", \"status\":\"active\" } ] } }" to string where no quotes for keys: "{ entity:{ id:\"7fbe7e65-0f01-4934-a2a9-dcc6d81a5b95\", type:\"Products\", status:\"pending\", services:[ { id:\"1e05737e-754b-4d19-b872-5a0135d99cf4\", type:\"Services\", status:\"active\" },{ id:\"2238fe75-3d1a-4768-8464-be7d48037215\", type:\"Services\", […]

Categories
Mastering Development

Create multiple json objects by using for loop

I’m in the process of creating a billing system and need to output some data from my API. I want to return the data as JSON, but i’m only getting one of the db entries in my output, even though there is multiple. I strongly assume that im overwriting my earlier entry. Current output is: […]

Categories
Mastering Development

FIlter the text content and try to convert filtered content into JSON

I’m having an input in the form of a string variable msg.payload as given below. Hi Team, Below are the details of for the given source platform. name=abc status=Active company=Discovery FromDate=6/05/2020 ToDate=20/05/2020 Please do the needful ASAP Thanks & Regards, xyz I want to take only the name=abc status=Active company=Discovery FromDate=6/05/2020 ToDate=20/05/2020 ignore the rest […]

Categories
Development

Webhook always failed authentication in Authorize.Net

In Authorize.Net created the subscription and recurring events handling using webhook. When I test using the web hook account authentication works but in actual webhook notification always failed authentication if (isset($this->header[‘x-anet-signature’])) { $json = Json::encode($this->body); if ($json) { //To check the header and signature is true if (hash_equals(strtolower($this->header[‘x-anet-signature’]), ‘sha512=’ . hash_hmac(‘sha512’,$json, $secret)) ) { }else{ […]

Categories
API Development

Is there any way EF and WebAPI2 to have update only passing fields in list of some class object?

I have class called User and i am passing in one of the WebAPI2 method say Manage (UsersList request) i.e. UsersList is list of User class as an input parameter on which i will be performing the insert, update operation based on action i have passed with each User class object. i wanted to know […]

Categories
Development JSON

is there difference between the json.loads in python2.7 vs python3

We are migrating from python2.7 to python3. We are seeing the json.loads is not returning the same response in python2.7 and python3. Below is an example. As we can see the json.loads in both of the versions return different results. I wanted to check if there is a way to fix this and have the […]