detect-json-indent

detect the indentation of stringified json

npm install detect-json-indent
2 downloads in the last week
18 downloads in the last month

detect JSON indent

detect(JSON.stringify(data, null, 4)) // '    '
detect(JSON.stringify(data, null, '\t')) // '\t'
detect(JSON.stringify(data, null, 2)) // '  '
detect(JSON.stringify(data)) // null

api

var detect = require('detect-json-indent');
var indentString = detect(jsonString);
npm loves you