How i can select a specific value from json?
up vote
0
down vote
favorite
What I'm trying to get is to select the "url" value of the "medium-mp4"
Component
componentDidMount() {
return fetch('https://you-link.herokuapp.com')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson,
videoUrl: responseJson[0].url
}, function() {
});
})
.catch((error) => {
console.error(error);
});
}
Json Call
Link
javascript reactjs react-native
|
show 1 more comment
up vote
0
down vote
favorite
What I'm trying to get is to select the "url" value of the "medium-mp4"
Component
componentDidMount() {
return fetch('https://you-link.herokuapp.com')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson,
videoUrl: responseJson[0].url
}, function() {
});
})
.catch((error) => {
console.error(error);
});
}
Json Call
Link
javascript reactjs react-native
1
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
Did you tryresponseJson[0]['medium-mp4'].url
?
– Hassan Imam
Nov 20 at 6:13
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
Please post theconsole.log(responseJson)
– Akrion
Nov 20 at 6:16
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
What I'm trying to get is to select the "url" value of the "medium-mp4"
Component
componentDidMount() {
return fetch('https://you-link.herokuapp.com')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson,
videoUrl: responseJson[0].url
}, function() {
});
})
.catch((error) => {
console.error(error);
});
}
Json Call
Link
javascript reactjs react-native
What I'm trying to get is to select the "url" value of the "medium-mp4"
Component
componentDidMount() {
return fetch('https://you-link.herokuapp.com')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson,
videoUrl: responseJson[0].url
}, function() {
});
})
.catch((error) => {
console.error(error);
});
}
Json Call
Link
javascript reactjs react-native
javascript reactjs react-native
asked Nov 20 at 6:10
bdroid
11310
11310
1
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
Did you tryresponseJson[0]['medium-mp4'].url
?
– Hassan Imam
Nov 20 at 6:13
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
Please post theconsole.log(responseJson)
– Akrion
Nov 20 at 6:16
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17
|
show 1 more comment
1
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
Did you tryresponseJson[0]['medium-mp4'].url
?
– Hassan Imam
Nov 20 at 6:13
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
Please post theconsole.log(responseJson)
– Akrion
Nov 20 at 6:16
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17
1
1
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
Did you try
responseJson[0]['medium-mp4'].url
?– Hassan Imam
Nov 20 at 6:13
Did you try
responseJson[0]['medium-mp4'].url
?– Hassan Imam
Nov 20 at 6:13
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
Please post the
console.log(responseJson)
– Akrion
Nov 20 at 6:16
Please post the
console.log(responseJson)
– Akrion
Nov 20 at 6:16
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17
|
show 1 more comment
4 Answers
4
active
oldest
votes
up vote
1
down vote
accepted
The response is not an array, it's an object, so you can't use 0. Try the object key you want instead.
{
videoUrl: responseJson['hd720-mp4'].url
}
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
add a comment |
up vote
2
down vote
let objMusic = JSON.parse('{"hd720-mp4":{"itag":"22","quality":"hd720","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&mime=video/mp4&lmt=1537717779316991&ip=2a02:4780:1:3::f&pl=48&itag=22&dur=295.706&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&sparams=dur,ei,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=B59110AC6E15FAE514C4B18679750702C9069E83.B0AC77A3AEBC7EC3CE20D218C67E8AE80E745E8A&ratebypass=yes&signature="},"medium-webm":{"itag":"43","quality":"medium","type":"video/webm","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1540750584717310&ip=2a02:4780:1:3::f&pl=48&dur=0.000&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&txp=5511222&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/webm&itag=43&fvip=5&ratebypass=yes&requiressl=yes&clen=30067021&signature=238FF11CC09F405CFD24423203F813EDFB5D66C2.3003162315BC1FF6A5D0C3B19BB03F9E1016E780&signature="},"medium-mp4":{"itag":"18","quality":"medium","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1537716294977165&ip=2a02:4780:1:3::f&pl=48&dur=295.706&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/mp4&itag=18&fvip=5&ratebypass=yes&requiressl=yes&clen=23503941&signature=DA800A9574CBF4EA8666390C6F98562A70EBE3EE.9C3BD58181B597C780E5264498B0919D2B0B8453&signature="},"small-3gpp":{"itag":"17","quality":"small","type":"video/3gpp","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&txp=5531232&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,expire&mime=video/3gpp&lmt=1540636712468197&ip=2a02:4780:1:3::f&pl=48&itag=17&dur=295.729&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&clen=2800636&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=4E618E1E6289DAC12A897896C9D2DEDA304DB55D.2240D0C7E9911C62537A948D6795EF7E171AA7CC&gir=yes&signature="}}')
if (objMusic['medium-mp4']) {
let mp4 = objMusic['medium-mp4']
let url = mp4.url
alert(JSON.stringify(url))
}
You can use above to get the url value.
add a comment |
up vote
1
down vote
Try this code snippet
videoUrl: responseJson['medium-mp4'].url
add a comment |
up vote
0
down vote
responseJson['hd720-mp4']['url']
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387201%2fhow-i-can-select-a-specific-value-from-json%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The response is not an array, it's an object, so you can't use 0. Try the object key you want instead.
{
videoUrl: responseJson['hd720-mp4'].url
}
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
add a comment |
up vote
1
down vote
accepted
The response is not an array, it's an object, so you can't use 0. Try the object key you want instead.
{
videoUrl: responseJson['hd720-mp4'].url
}
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The response is not an array, it's an object, so you can't use 0. Try the object key you want instead.
{
videoUrl: responseJson['hd720-mp4'].url
}
The response is not an array, it's an object, so you can't use 0. Try the object key you want instead.
{
videoUrl: responseJson['hd720-mp4'].url
}
answered Nov 20 at 6:15
Rafael Grilli
429314
429314
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
add a comment |
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
I have tried this but not work: componentDidMount() { return fetch('www.url.com') .then((response) => response.json()) .then((responseJson) => { let url = responseJson.find(obj => obj.responseJson['hd720-mp4']).url this.setState({ isLoading: false, dataSource: responseJson, videoUrl: url }, function() {}); }) .catch((error) => { console.error(error); }); }
– bdroid
Nov 20 at 6:19
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
You checked as "right answer" the same thing I told you to do lol
– Rafael Grilli
Nov 20 at 9:37
1
1
I did, thank you
– bdroid
Nov 20 at 14:02
I did, thank you
– bdroid
Nov 20 at 14:02
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
@bdroid thankss :)
– Rafael Grilli
Nov 20 at 14:28
add a comment |
up vote
2
down vote
let objMusic = JSON.parse('{"hd720-mp4":{"itag":"22","quality":"hd720","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&mime=video/mp4&lmt=1537717779316991&ip=2a02:4780:1:3::f&pl=48&itag=22&dur=295.706&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&sparams=dur,ei,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=B59110AC6E15FAE514C4B18679750702C9069E83.B0AC77A3AEBC7EC3CE20D218C67E8AE80E745E8A&ratebypass=yes&signature="},"medium-webm":{"itag":"43","quality":"medium","type":"video/webm","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1540750584717310&ip=2a02:4780:1:3::f&pl=48&dur=0.000&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&txp=5511222&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/webm&itag=43&fvip=5&ratebypass=yes&requiressl=yes&clen=30067021&signature=238FF11CC09F405CFD24423203F813EDFB5D66C2.3003162315BC1FF6A5D0C3B19BB03F9E1016E780&signature="},"medium-mp4":{"itag":"18","quality":"medium","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1537716294977165&ip=2a02:4780:1:3::f&pl=48&dur=295.706&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/mp4&itag=18&fvip=5&ratebypass=yes&requiressl=yes&clen=23503941&signature=DA800A9574CBF4EA8666390C6F98562A70EBE3EE.9C3BD58181B597C780E5264498B0919D2B0B8453&signature="},"small-3gpp":{"itag":"17","quality":"small","type":"video/3gpp","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&txp=5531232&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,expire&mime=video/3gpp&lmt=1540636712468197&ip=2a02:4780:1:3::f&pl=48&itag=17&dur=295.729&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&clen=2800636&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=4E618E1E6289DAC12A897896C9D2DEDA304DB55D.2240D0C7E9911C62537A948D6795EF7E171AA7CC&gir=yes&signature="}}')
if (objMusic['medium-mp4']) {
let mp4 = objMusic['medium-mp4']
let url = mp4.url
alert(JSON.stringify(url))
}
You can use above to get the url value.
add a comment |
up vote
2
down vote
let objMusic = JSON.parse('{"hd720-mp4":{"itag":"22","quality":"hd720","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&mime=video/mp4&lmt=1537717779316991&ip=2a02:4780:1:3::f&pl=48&itag=22&dur=295.706&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&sparams=dur,ei,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=B59110AC6E15FAE514C4B18679750702C9069E83.B0AC77A3AEBC7EC3CE20D218C67E8AE80E745E8A&ratebypass=yes&signature="},"medium-webm":{"itag":"43","quality":"medium","type":"video/webm","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1540750584717310&ip=2a02:4780:1:3::f&pl=48&dur=0.000&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&txp=5511222&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/webm&itag=43&fvip=5&ratebypass=yes&requiressl=yes&clen=30067021&signature=238FF11CC09F405CFD24423203F813EDFB5D66C2.3003162315BC1FF6A5D0C3B19BB03F9E1016E780&signature="},"medium-mp4":{"itag":"18","quality":"medium","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1537716294977165&ip=2a02:4780:1:3::f&pl=48&dur=295.706&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/mp4&itag=18&fvip=5&ratebypass=yes&requiressl=yes&clen=23503941&signature=DA800A9574CBF4EA8666390C6F98562A70EBE3EE.9C3BD58181B597C780E5264498B0919D2B0B8453&signature="},"small-3gpp":{"itag":"17","quality":"small","type":"video/3gpp","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&txp=5531232&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,expire&mime=video/3gpp&lmt=1540636712468197&ip=2a02:4780:1:3::f&pl=48&itag=17&dur=295.729&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&clen=2800636&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=4E618E1E6289DAC12A897896C9D2DEDA304DB55D.2240D0C7E9911C62537A948D6795EF7E171AA7CC&gir=yes&signature="}}')
if (objMusic['medium-mp4']) {
let mp4 = objMusic['medium-mp4']
let url = mp4.url
alert(JSON.stringify(url))
}
You can use above to get the url value.
add a comment |
up vote
2
down vote
up vote
2
down vote
let objMusic = JSON.parse('{"hd720-mp4":{"itag":"22","quality":"hd720","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&mime=video/mp4&lmt=1537717779316991&ip=2a02:4780:1:3::f&pl=48&itag=22&dur=295.706&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&sparams=dur,ei,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=B59110AC6E15FAE514C4B18679750702C9069E83.B0AC77A3AEBC7EC3CE20D218C67E8AE80E745E8A&ratebypass=yes&signature="},"medium-webm":{"itag":"43","quality":"medium","type":"video/webm","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1540750584717310&ip=2a02:4780:1:3::f&pl=48&dur=0.000&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&txp=5511222&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/webm&itag=43&fvip=5&ratebypass=yes&requiressl=yes&clen=30067021&signature=238FF11CC09F405CFD24423203F813EDFB5D66C2.3003162315BC1FF6A5D0C3B19BB03F9E1016E780&signature="},"medium-mp4":{"itag":"18","quality":"medium","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1537716294977165&ip=2a02:4780:1:3::f&pl=48&dur=295.706&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/mp4&itag=18&fvip=5&ratebypass=yes&requiressl=yes&clen=23503941&signature=DA800A9574CBF4EA8666390C6F98562A70EBE3EE.9C3BD58181B597C780E5264498B0919D2B0B8453&signature="},"small-3gpp":{"itag":"17","quality":"small","type":"video/3gpp","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&txp=5531232&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,expire&mime=video/3gpp&lmt=1540636712468197&ip=2a02:4780:1:3::f&pl=48&itag=17&dur=295.729&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&clen=2800636&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=4E618E1E6289DAC12A897896C9D2DEDA304DB55D.2240D0C7E9911C62537A948D6795EF7E171AA7CC&gir=yes&signature="}}')
if (objMusic['medium-mp4']) {
let mp4 = objMusic['medium-mp4']
let url = mp4.url
alert(JSON.stringify(url))
}
You can use above to get the url value.
let objMusic = JSON.parse('{"hd720-mp4":{"itag":"22","quality":"hd720","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&mime=video/mp4&lmt=1537717779316991&ip=2a02:4780:1:3::f&pl=48&itag=22&dur=295.706&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&sparams=dur,ei,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=B59110AC6E15FAE514C4B18679750702C9069E83.B0AC77A3AEBC7EC3CE20D218C67E8AE80E745E8A&ratebypass=yes&signature="},"medium-webm":{"itag":"43","quality":"medium","type":"video/webm","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1540750584717310&ip=2a02:4780:1:3::f&pl=48&dur=0.000&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&txp=5511222&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/webm&itag=43&fvip=5&ratebypass=yes&requiressl=yes&clen=30067021&signature=238FF11CC09F405CFD24423203F813EDFB5D66C2.3003162315BC1FF6A5D0C3B19BB03F9E1016E780&signature="},"medium-mp4":{"itag":"18","quality":"medium","type":"video/mp4","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&lmt=1537716294977165&ip=2a02:4780:1:3::f&pl=48&dur=295.706&mv=u&source=youtube&ms=au,onr&ei=sKPzW-6XIZCPj-8PzruZ-A4&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source,expire&mt=1542693264&expire=1542715408&key=yt6&gir=yes&ipbits=0&c=WEB&mime=video/mp4&itag=18&fvip=5&ratebypass=yes&requiressl=yes&clen=23503941&signature=DA800A9574CBF4EA8666390C6F98562A70EBE3EE.9C3BD58181B597C780E5264498B0919D2B0B8453&signature="},"small-3gpp":{"itag":"17","quality":"small","type":"video/3gpp","url":"https://r5---sn-5uaezn6y.googlevideo.com/videoplayback?mn=sn-5uaezn6y,sn-q4flrnl7&mm=31,26&txp=5531232&id=o-AID9zwFrzXB9sFZjRYPFuJyVV_ViYTpwz40-0Po2qR-P&c=WEB&sparams=clen,dur,ei,gir,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,expire&mime=video/3gpp&lmt=1540636712468197&ip=2a02:4780:1:3::f&pl=48&itag=17&dur=295.729&mv=u&source=youtube&ms=au,onr&fvip=5&ei=sKPzW-6XIZCPj-8PzruZ-A4&requiressl=yes&clen=2800636&mt=1542693264&expire=1542715408&ipbits=0&key=yt6&signature=4E618E1E6289DAC12A897896C9D2DEDA304DB55D.2240D0C7E9911C62537A948D6795EF7E171AA7CC&gir=yes&signature="}}')
if (objMusic['medium-mp4']) {
let mp4 = objMusic['medium-mp4']
let url = mp4.url
alert(JSON.stringify(url))
}
You can use above to get the url value.
answered Nov 20 at 6:27
Nirmalsinh
2,99031336
2,99031336
add a comment |
add a comment |
up vote
1
down vote
Try this code snippet
videoUrl: responseJson['medium-mp4'].url
add a comment |
up vote
1
down vote
Try this code snippet
videoUrl: responseJson['medium-mp4'].url
add a comment |
up vote
1
down vote
up vote
1
down vote
Try this code snippet
videoUrl: responseJson['medium-mp4'].url
Try this code snippet
videoUrl: responseJson['medium-mp4'].url
answered Nov 20 at 6:30
Advait
215
215
add a comment |
add a comment |
up vote
0
down vote
responseJson['hd720-mp4']['url']
add a comment |
up vote
0
down vote
responseJson['hd720-mp4']['url']
add a comment |
up vote
0
down vote
up vote
0
down vote
responseJson['hd720-mp4']['url']
responseJson['hd720-mp4']['url']
answered Nov 20 at 6:22
Randy Rebucas
1065
1065
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387201%2fhow-i-can-select-a-specific-value-from-json%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
videoUrl: responseJson["medium-mp4"].url
– Amit Joki
Nov 20 at 6:12
Did you try
responseJson[0]['medium-mp4'].url
?– Hassan Imam
Nov 20 at 6:13
I've tried it and it does not work
– bdroid
Nov 20 at 6:16
Please post the
console.log(responseJson)
– Akrion
Nov 20 at 6:16
jsoneditoronline.org/?id=e0c8c701dc5d4fa69797b3737b7fd5db
– bdroid
Nov 20 at 6:17