This might be something quite trivial, but I have very little experience in the field so it might as well turn out quite complicated.
Basically, I'm trying to render a bunch of HTML data attributes into their JSON equivalents. For example I have the following HTML markup (I've cut it since it's too long):
<span class="play-queue play-queue-med-small" data-json=
"{"id":
4276028,
"selected":
false,"type":
"track","sku":
"track-4276028","name":
"This Is What It Feels Like feat. Trevor Guthrie","trackNumber":
2,"active":true,"mixName":
"W&
W Remix","title":
"
This Is What It Feels Like feat. Trevor Guthrie
(W&W Remix)","slug":
"
;this-is-what-it-feels-like-feat-trevor-guthrie-w-and-w-remix",
"isrc":"
NLF711303293","releaseDate":
"2013-04-05","publishDate":"2013-04-05","sampleUrl":"
From this I want to render the data-json attribute into a JSON record looking like:
{
“key1”:”value1”,
“key2”:”value2”,
...
“keyN”:”valueN”
}
Is there any way to do this? Maybe a method (either in C# or in Java), or some workaround?
Thank you a million in advance!
The client side solution would look like:
JSON.parse(unescape($('span.play-queue').data('json')))
The C# equivelent is the HttpUtility.HtmlDecode