I want to fetch the given JSON data to a mustache template.
{
"1": {
"feedbackid": "1",
"name": "Harshad",
"email": "harshadbindra#gmail.com",
"message": "asdasdf"
},
"2": {
"feedbackid": "2",
"name": "Tom",
"email": "tom#gmail.com",
"message": "test"
},
"3": {
"feedbackid": "3",
"name": "Harshad",
"email": "harshadbindra#gmail.com",
"message": "asdfasdfas"
}
}
All this data is contained in a variable $data. So, how can you access it within the .mustache file?
Thanks in advance.
Related
I'm experiencing a weird response from a server api.
When I'm logging the res.data,this is the structure I got back:
[
{
"id": "3",
"name": "Jack"
},
{
"id": "4",
"name": "Paul"
}
]
{
"timestamp": 1626798750349,
"status": 200,
"error": "OK",
"path": "/api/logs/documents/323232"
}
Do you guys have any idea why that object was appended here at the end, preventing me to iterate through the res.data? There is a way from the front end to get rid of it with a regex expression?
Thanks
When I am using get api and get the data in json format
{
"uuid": "46d00217-6e35-485c-ac20-c204a8a24a68",
"name": "AMan",
"dispute_location": "Hyder",
"max_dispute_value": "200",
"min_dispute_value": "100",
"state": "U.p",
"district": "morene",
"calendar_id": "3",
"description": null,
"subject_matters": [
{
"id": 1,
"name": "A",
"created_at": "2020-08-14T12:24:52.000000Z",
"updated_at": "2020-08-14T12:24:52.000000Z",
"pivot": {
"court_uuid": "46d00217-6e35-485c-ac20-c204a8a24a68",
"subject_matter_id": 1
}
},
{
"id": 2,
"name": "B",
"created_at": "2020-08-14T12:24:57.000000Z",
"updated_at": "2020-08-14T12:24:57.000000Z",
"pivot": {
"court_uuid": "46d00217-6e35-485c-ac20-c204a8a24a68",
"subject_matter_id": 2
}
}
]
}
but i want subject_matters data in this format
"subject_matters": [1,2]
Api resource (court resources)
You can use ->pluck('id'); in your resource.
return [
'subject_matters_id' => $this->subjectMatters->pluck('id')
]
It should return an array of subject matter IDs.
I have some monotonous Json response in which I am trying access element of dictionary of array of dictionary of array using node.js but hard luck and unable to do so. I have tried accessing this stackoverflow solution https://stackoverflow.com/questions/30448517/node-js-how-to-access-values-of-dictionary-within-an-array-of-a-key-in-a-dicti but in my case this is not working appropriately. My Json response is :
{
"client": [
{
"code": [
{
"id": "001",
"code": "100",
"type": "New"
},
{
"id": "002",
"code": "200",
"type": "Old"
}
]
}
]
}
From this response I want to get value of each "id", "code" and "Type". Any valuable answer would be appreciated. Thank you !!!
If your json was assigned to the variable x
x = {
"client": [
{
"code": [
{
"id": "001",
"code": "100",
"type": "New"
},
{
"id": "002",
"code": "200",
"type": "Old"
}
]
}
]
}
console.log(x["client"][0]["code"][0]["id"])
(I'll leave iterating through the arrays as an exercise for the reader)
I am new to angular js.I am trying to fetch data from url.I know how to fetch data from json with single array.But if the json has many arrays,then how to fetch it?
For example:
The json is as follows:
{
"Details": [{
"approved": [{
"count": "2124",
"type": "Approved ",
"desc": "New registration"
}, {
"count": "902",
"type": "Deemed approved ",
"desc": "New registration"
}, {
"count": "60",
"type": "Approved ",
"desc": null
}, {
"count": "5",
"type": "Deemed approved ",
"desc": null
}, {
"count": "29",
"type": "Approved ",
"desc": null
}]
}, {
"pending": [{
"count": "492",
"type": "Amendment of core fields"
}, {
"count": "18",
"type": "New registration"
}, {
"count": "1",
"type": null
}]
}, {
"rejected": [{
"count": "29",
"type": "New registration"
}]
}, {
"resubmit": [{
"count": "9",
"type": "New registration"
}]
}]
}
Lets say you send the request as follows:
$http.get('/data').then(function(response) {
response // your JSON
});
Now inside response you will have your entire JSON as a javascript object. So you can use it as follows:
response.Details.approved[0].count // 2124
response.Details.pending[0].count // 492
I have been working on Salesforce to Docusign Integration. I have multiple documents with Specific signer for each document i.e. one document should be send to one specific user, not all. But I want to do this in one Rest API call to docusign! The documents are stored in Accounts attachments which are created dynamically for each user which are specific to user.
I have been trying this using CompositeTemplates, what I am doing is, adding document and Signer in each inlineTemplate, But it is sending all the documents to all the users in sequence.
I don't want to show all document to all the user, they should see only document specific to them.
Below is the JSON which I am sending:
{
"status": "Sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 1",
"recipientId": "1",
"name": "Anmol",
"email": "test#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test1"
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": "JVBERi0xLjQKJeLjz9MKN58HkeCg8gJEomcWGJdEFtOYYklsXV2dlT6R6Owc+FXFMNSlpckKM6M/ioTGkROkEjkxBDrgthySkvMxGpQJYapHKWwcwXtRU9GCg=="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "1"
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 2",
"recipientId": "1",
"name": "Anmol",
"email": "test1#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test2"
},
"documents": [
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": "JVBERi0xLjYNJeLjz9MNCjEzIDAgb2JqDTw8L0xpbmVhcmlmDQoxMTYNCiUlRU9GDQo="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "2"
}
]
}
Any doc, code or suggestions about the approach I am following for this will be very helpful.
To do it in a single api call, specify the excludedDocuments property in the EnvelopeCreate request
excludedDocuments: Specifies the documents that are not visible to the recipient. Document Visibility must be enabled for the account and the enforceSignerVisibility property must be set to true for the envelope to use this.
Here is a sample Json for POST /v2/accounts/{accountId}/envelopes
Note: I have combined both your inline templates into a single inlineTemplate.
{
"status": "Sent",
"emailSubject": "Email Subject to all recipients",
"emailBlurb": "Email body to all recipients",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"recipientId": "1",
"name": "recipient one",
"email": "recipientone#dsxtr.com",
"excludedDocuments": [ "2" ]
},
{
"recipientId": "2",
"name": "recipient two",
"email": "recipienttwo#dsxtr.com",
"excludedDocuments": [ "1" ]
}
]
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": ""
},
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": ""
}
]
}
],
"compositeTemplateId": "1"
}
]
}
I believe you're looking for documentVisibility on the create envelope call.
There are other supporting documentVisibility endpoints here.