Having problem with a api data

24 views
Skip to first unread message

surendra bhaskar

unread,
Oct 10, 2020, 6:21:08 AM10/10/20
to django...@googlegroups.com
I am able to get all data from api but  not able to get certain
values which have - in between of 2 words
"dismissal": "catch",
                "SR": 120,
                "6s": 0,
                "4s": 2,
                "M": 0,
                "B": 10,
                "R": 12,
                "dismissal-info": "c Curran b Chawla", <== this type is not working 
                "batsman": "RG Sharma (c)",
                "pid": "34102"


 Trying this code to get data  
 document.write(JSON.stringify(data.data.fielding[0].scores[0].SR)) <== working
  document.write(JSON.stringify(data.data.batting[0].scores[0].batsman)) <== working
  document.write(JSON.stringify(data.data.batting[0].scores[0].dismissal)) <== working
   document.write(JSON.stringify(data.data.batting[0].scores[0].dismissal-info)) <==                    showing  info is not defined
I am tried with a lot but finally failed to get this type of data so can you pls help me out 
image.png
Thank You,
Surendra Ediga

Roger Gammans

unread,
Oct 10, 2020, 7:27:19 PM10/10/20
to django...@googlegroups.com, surendra bhaskar
This is really a JavaScript question not a Django one.

But since I can see the problem... ,

The issue is 'dissmal-info' isn't a valid Js identifier, the browser is trying to subtract the nonexistent 'info' variable from the 'dismissal' value. You should be able to use ['dismissal-info'] instead of . dismissal-info.







On 10 October 2020 07:19:06 BST, surendra bhaskar <surendra....@siesgst.ac.in> wrote:
>*I am able to get all data from api but not able to get certainvalues
>which have - in between of 2 words*
>"dismissal": "catch",
> "SR": 120,
> "6s": 0,
> "4s": 2,
> "M": 0,
> "B": 10,
> "R": 12,
> "dismissal-info": "c Curran b Chawla", <== this type is not
>working
> "batsman": "RG Sharma (c)",
> "pid": "34102"
>
>
>* Trying this code to get data *
> document.write(JSON.stringify(data.data.fielding[0].scores[0].SR)) <==
>working
> document.write(JSON.stringify(data.data.batting[0].scores[0].batsman))
><== working
>document.write(JSON.stringify(data.data.batting[0].scores[0].dismissal))
><== working
>
>document.write(JSON.stringify(data.data.batting[0].scores[0].dismissal-info))
><== showing info is not defined
>*I am tried with a lot but finally failed to get this type of data so
>can
>you pls help me out *
>[image: image.png]
>*Thank You,*
>*Surendra Ediga*

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

surendra bhaskar

unread,
Oct 11, 2020, 10:40:46 AM10/11/20
to Roger Gammans, django...@googlegroups.com
Thank you 
Surendra Ediga


Dvs Khamele

unread,
Oct 11, 2020, 4:59:32 PM10/11/20
to django...@googlegroups.com, Roger Gammans
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices
Best Regards, 
Divyesh Khamele,
Pythonmate

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPT84Tm2HpKvA_ggtC3F34TqhfsesNvH75u3-NzAeVDjBG0WRg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages