0
En revisión

Query JSON

robbtt hace 10 años actualizado hace 10 años 2
Hello, 

I have this JSON

{
"update_date": "now",
"sender_wpid": 337,
"create_date": "now",
"sender": {
"phone_number": 8168660464,
"last_name": "Hebert",
"terms_agreed": true,
"grade": null,
"completed_teacher_tour": true,
"message_email": true,
"activity_never": false,
"general_post_weekly": false,
"is_staff": true,
"phone_carrier": "T-Mobile",
"student_number": null,
"id": 337,
"general_post_everytime": false,
"first_name": "Gattttttt",
"recorded_text": false,
"display_name": "Fishy1",
"tagline": "",
"zipcode": 64116,
"recorded_phone": true,
"is_superuser": true,
"hero_path": "https://8aeeba429ba2c635a2c4-1bddc9f99e1f15179867543d76f0136f.ssl.cf2.rackcdn.com/2014/06/f8e824312a824c409a5776902e35b54f.jpg",
"invited_to_entity": null,
"message_twitter": false,
"activity_daily": true,
"email": "gatlin.hebert@dewsly.com",
"over_13": true,
"avatar_path": "https://8aeeba429ba2c635a2c4-1bddc9f99e1f15179867543d76f0136f.ssl.cf2.rackcdn.com/2014/04/f1a221cfbcbe4d9d9976bf6e5568e4f5.jpg",
"race": null,
"description": "A Republican, his election to the presidency on an anti-slavery platform helped to precipitate the Civil War, which was fought during his administration. He was assassinated shortly after the war ended and before he could fulfill his campaign promise to reconcile the North and the South. He was noted for his succinct, eloquent speeches, including the Gettysburg Address of 1863.",
"completed_tour": true,
"change_password": false,
"is_active": true,
"invited_by": null,
"general_post_daily": true,
"general_post_never": false,
"activity_weekly": false,
"sis_id": null,
"teacher": false,
"onboarding_complete": true,
"teacher_number": null,
"slug": null,
"clever_id": null,
"recorded_email": true,
"url": "test",
"gender": null,
"suggest_clear": false,
"invited_to_group": null,
"username": "gatlin.hebert@dewsly.com",
"hispanic_ethnicity": false,
"english_second_language": false,
"activity_everytime": false,
"message_text": true,
"state_id": null
},
"thread": {
"groups": "",
"update_date": "1 day ago",
"sender_wpid": null,
"create_date": "1 day ago",
"sender": {
"phone_number": 8168660464,
"last_name": "Hebert",
"terms_agreed": true,
"grade": null,
"completed_teacher_tour": true,
"message_email": true,
"activity_never": false,
"general_post_weekly": false,
"is_staff": true,
"phone_carrier": "T-Mobile",
"student_number": null,
"id": 337,
"general_post_everytime": false,
"first_name": "Gattttttt",
"recorded_text": false,
"display_name": "Fishy1",
"tagline": "",
"zipcode": 64116,
"recorded_phone": true,
"is_superuser": true,
"hero_path": "https://8aeeba429ba2c635a2c4-1bddc9f99e1f15179867543d76f0136f.ssl.cf2.rackcdn.com/2014/06/f8e824312a824c409a5776902e35b54f.jpg",
"invited_to_entity": null,
"message_twitter": false,
"activity_daily": true,
"email": "gatlin.hebert@dewsly.com",
"over_13": true,
"avatar_path": "https://8aeeba429ba2c635a2c4-1bddc9f99e1f15179867543d76f0136f.ssl.cf2.rackcdn.com/2014/04/f1a221cfbcbe4d9d9976bf6e5568e4f5.jpg",
"race": null,
"description": "A Republican, his election to the presidency on an anti-slavery platform helped to precipitate the Civil War, which was fought during his administration. He was assassinated shortly after the war ended and before he could fulfill his campaign promise to reconcile the North and the South. He was noted for his succinct, eloquent speeches, including the Gettysburg Address of 1863.",
"completed_tour": true,
"change_password": false,
"is_active": true,
"invited_by": null,
"general_post_daily": true,
"general_post_never": false,
"activity_weekly": false,
"sis_id": null,
"teacher": false,
"onboarding_complete": true,
"teacher_number": null,
"slug": null,
"clever_id": null,
"recorded_email": true,
"url": "test",
"gender": null,
"suggest_clear": false,
"invited_to_group": null,
"username": "gatlin.hebert@dewsly.com",
"hispanic_ethnicity": false,
"english_second_language": false,
"activity_everytime": false,
"message_text": true,
"state_id": null
},
"wp_users": null,
"sender_id": 337,
"urgent": false,
"wp_schools": null,
"sender_name": "https://745f13cdb0c300e0238c-79a1d4fbd7fa758b8e17f... style=\"width:14px;float:none;\">Fishy1",
"schools": "",
"wp_groups": null,
"users": "337,615",
"allow_replies": true,
"id": 1821,
"wp_districts": null
},
"sender_name": "Fishy1",
"sender_id": 337,
"id": 2006,
"content": "test",
"thread_id": 1821,
"recording_url": null,
"sender_avatar": "https://8aeeba429ba2c635a2c4-1bddc9f99e1f151798675...
"attachments": [
{
"update_date": "now",
"user_id": 337,
"name": "http://www.macmillandictionaryblog.com/wp-content/...
"url": "http://www.macmillandictionaryblog.com/wp-content/...
"parent_id": 2006,
"create_date": "now",
"user": "Fishy1",
"active": true,
"id": 49
}
]
}


How can I access the url of attachments all the way in the bottom? Right now doing [datasource:message-reply.1.attachments] returns the whole attachments JSON. However, I only want the url inside attachments. I also tried [datasource:message-reply.1.attachments/url] and [datasource:message-reply.1.attachments.url]. None of these worked. 

Thanks!
En revisión
<!--Sample Datasource tag-->
<datasource name="example" source="" query="/example" providertype="json" querycomplete="done"/>
<!-- this should show the first phone number in the json array of the first result in the datasource as a json string -->
<alert message="[datasource:example.1.phone[0]]"/>                
<!-- this should show the first phone number in the json array of the first result in the datasource -->
<alert message="[datasource:example.1.phone[0]/number]"/>                

<!-- JSON Array Sample Source Content-->

{   
   "example":[      
      {         
	"phone":[           
	   {               
	      "label":"mobile",               
	      "number":"+1913555336"           
	   },
           {              
	      "label":"home",              
	      "number":"+098745621"            
	   },           
	   {              
	      "label":"office",               
	      "number":"+123456789"            
	   }         
        ]     
      }   
    ]
}
That worked! Thanks!