Skip to content

Instantly share code, notes, and snippets.

@Fenil265
Fenil265 / json-format-and-validate.md
Created February 22, 2026 17:59
JSON formatting and validation examples with common errors and fixes

JSON Format and Validate Example

JSON (JavaScript Object Notation) is the most common data format used in APIs, configuration files, and web applications.
However, even a small syntax error—like a missing comma or quote—can break JSON parsing.

This guide explains how to format and validate JSON data correctly, with examples.


What Does JSON Formatting Mean?

@Fenil265
Fenil265 / json-to-csv-example.md
Created February 22, 2026 17:45
JSON to CSV conversion example with Excel-friendly output

JSON to CSV Conversion Example

JSON (JavaScript Object Notation) is widely used by APIs and web applications to exchange data.
However, spreadsheet tools like Microsoft Excel and Google Sheets work best with CSV (Comma-Separated Values) format.

This example shows how to convert JSON data into CSV format for easy analysis and reporting.


Input JSON

body.modal-open {
overflow: hidden;
}
$("#edit-followings").on("show", function () {
$("body").addClass("modal-open");
}).on("hidden", function () {
$("body").removeClass("modal-open")
});
document.getElementById('foo').onkeypress = function(e){
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13'){
// Enter pressed
return false;
}
}
var jsonSearch = function(json_array,needle){
return json_array.map(function(d) { return d[Object.keys(needle)[0]]; }).indexOf(needle[Object.keys(needle)[0]])
};
a = [
{prop1:"abc",prop2:"qwe"},
{prop1:"bnmb",prop2:"yutu"},
{prop1:"zxvz",prop2:"qwrq"}];
index = a.findIndex(x => x.prop2 ==="yutu");
console.log(index);
@Fenil265
Fenil265 / REGEX FOR URLS
Created December 13, 2018 08:44
Reference for URL REGEX
https://mathiasbynens.be/demo/url-regex
$(selector).popover({ trigger: "manual" , html: false, animation:true})
.on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
// Internet Explorer 6-11