function jsonToHtml(data) {
var result = "<ol>";
for (var key in data) {
if (typeof (data[key]) == 'object' && data[key] != null) {
result += "<li><span class='key'>" + key + "</span>:<ul>";
result += jsonToHtml(data[key]);
result += '</ul></li>';
}
else {
result += "<li><span class='key'>" + key + '</span>: ';
result += '<span class="string">' + data[key] + '</span></li>';
}
};
result += '</ol>';
return (result);
}
27 August 2015
JS - Convert a (nested) JSON object to HTML
For testing purposes I wanted to display the JSON retrieved from an API in a HTML page. I used Fiddler for that, but after some security was included that became impossible. The following Javascript function converts the JSON to a ordered list tree:
05 August 2015
.NET - What is a GUID?
I found out something interesting today. I always thought a GUID was a string, but as it turns out, it's 128 bits of binary data that is represented in hexadecimal numbers, making it appear like a string. That makes the question of whether a GUID is case-insensitive irrelevant. It would also be better to store GUID's in a binary field rather than a text field.
Subscribe to:
Comments (Atom)