Search Results

Search found 2 results on 1 pages for 'brabertaser1992'.

Page 1/1 | 1 

  • Rails rabl json format

    - by brabertaser1992
    I'm displaying data from my db in json format using rabl to parse it for android... My json looks like so: [ { "bank":{ "central_office_address":"ololo", "license":"12312312", "location_id":3, "name":"Pbank", "tax_number":"12312312", "year_of_foundation":1987 } }, { "bank":{ "central_office_address":"sdfsdf sdf", "license":"321312", "location_id":3, "name":"Bbank", "tax_number":"321321", "year_of_foundation":1999 } } ] I need my json in a format like: { "contacts": [ { "id": "c200", "name": "Ravi Tamada", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } }, { "id": "c201", "name": "Johnny Depp", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } } ] } Such data is normally parsed in java.... My rabl view: object @banks attributes :central_office_address, :license, :location_id, :name, :tax_number, :year_of_foundation How do I change its output to match the second example?

    Read the article

  • Jquery select add values from json

    - by brabertaser1992
    I have such json: [ { "MOD_AXL": 0, "MOD_CDS_ID": 110000168, "MOD_CV": 0, "MOD_CV_CTM": null, "MOD_ID": 168, "MOD_MFA_ID": 514, "MOD_PC": 1, "MOD_PCON_END": 199007, "MOD_PCON_START": 196303, "MOD_PC_CTM": null, "Name": "2 CV"}, { "MOD_AXL": 0, "MOD_CDS_ID": 110004500, "MOD_CV": 0, "MOD_CV_CTM": null, "MOD_ID": 4500, "MOD_MFA_ID": 514, "MOD_PC": 1, "MOD_PCON_END": 198810, "MOD_PCON_START": 197808, "MOD_PC_CTM": null, "Name": "ACADIANE"}, { "MOD_AXL": 0, "MOD_CDS_ID": 110001660, "MOD_CV": 0, "MOD_CV_CTM": null, "MOD_ID": 1660, "MOD_MFA_ID": 514, "MOD_PC": 1, "MOD_PCON_END": 197712, "MOD_PCON_START": 196301, "MOD_PC_CTM": null, "Name": "AMI"} // etc..etc.. ]? But how to set as select value MOD_ID, and as text of select option: Name? I have this data in text: $(".man-select").change(function(){ var mfa_id = $(".man-select").val(); console.log(mfa_id); $.ajax({ url: "/get_models_for_mfa/mfa_id="+mfa_id+".json", type: "GET", data: {}, success: function(text) //here is object { console.log("getted"); $('.mod-select') .append($("<option></option>") .attr("value",text) .text(text)); }, error: function(){ //alert('?????? javascript'); }, dataType : "html" }); });

    Read the article

1