0

How do I get get the value url from this string:

[{
    "url": "https://www.filepicker.io/api/file/WGS4Wmkk",
    "filename": "4827889.jpg",
    "mimetype": "image/jpeg",
    "size": 53113,
    "key": "be7BxONVHe_48278891840.jpg",
    "isWriteable": false
}]

With jquery or regular javascript

1
  • Did you mean for that code to be an array containing an object? It's kinda scrunched up, and it doesn't have quotations. Commented Jan 30, 2013 at 23:54

1 Answer 1

8

If str is the string you posted above, you can use JSON to parse it:

var data = JSON.parse(str);
console.log(data[0].url); // the url value
Sign up to request clarification or add additional context in comments.

1 Comment

And the jQuery version: var data = $.parseJSON(str);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.