this row.id is not printing & returning an error. The json response is something like: [{"id": "wwkj", "name": "loki" }, {"id": "wyht", "name": "ann" }, . . . . ]
I have a requirement Json parser is storing JSON file in one custom object,I need to create a lighting component for that Json file which is stored in custom object ?
All Answers
Firstly, I found the recommendation (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_attr_types_object.htm) that Map[] should be used instead of Object[].
and found the syntax for using in default:
Or, working from your example, to create it in the controller:
And to iterate in a table:
I am hitting a api which is responding me a Json Array. I am writing the code in Apex class in lightning component.
Apex code:
String op=resp.getBody(); List<Object> result = (List<Object>)JSON.deserializeUntyped(op);
return result;
Helper class:
var returnb = response.getReturnValue(); component.set("v.jsonArray", returnb);
In cmponent:
<aura:attribute name="jsonArray" type="Object[]"/> <aura:if isTrue= "{!not(empty(v.jsonArray))}" >
<table class="slds-table slds-border_left slds-border_right">
<tbody>
<aura:iteration items="{!v.jsonArray}" var="row">
<tr>
<td> {!row.id} </td>
this row.id is not printing & returning an error.
The json response is something like:
[{"id": "wwkj", "name": "loki" }, {"id": "wyht", "name": "ann" }, . . . . ]
Please let me know what's wrong with this.