JSON FAQ

Usage from Address Bar

You can use direct access to this page from your browser address bar. Type string that you need to encode/decode with algorithm according to next schema: https://md5calc.com/json/<TYPE:enc|dec>/<PHRASE> For example to visit page that contains encoded "hello world" you can just visit url: https://md5calc.com/json/enc/hello+world The another cool thing is that you can specify "json" or "plain" mode into URL and you will get only encoded/decoded in response.
Schema of this future: https://md5calc.com/json/<TYPE:enc|dec>.<OUTPUT:plain|json>/<PHRASE> Example: https://md5calc.com/json/enc.plain/hello+world Will output: "hello world"

Usage from PHP

You can use direct access to this function in your applications.

PHP Example:

<?php
    $str = 'hello world';
    $url ='https://md5calc.com/json/enc.plain/'.urlencode($str);
    $json = file_get_contents($url);
    echo 'Base64 of "'.$str.'" is "'.$json.'"';
Will output: JSON of "hello world" is ""hello world""

How to make the same in PHP

<?php
    $str = '¡Hola!';
    $jsonEncodedStr = json_encode($str);
    $jsonDecodedStr = json_decode($jsonEncodedStr, true);
    echo '<pre>';
    echo $str.PHP_EOL
         .' &rarr; '.$jsonEncodedStr.PHP_EOL
         .' &rarr; '.print_r($jsonDecodedStr, true).PHP_EOL
    ;
    echo '</pre>';

How to make the same in JavaScript

var str = 'https://localhost/?param1=¡Hola!&param2=¡Hola!';
var jsonEncodedStr = JSON.stringify(str);
var jsonDecodedStr = JSON.parse(jsonEncodedStr);
console.log(str);
console.log('-> ' + jsonEncodedStr);
console.log('-> ' + jsonDecodedStr);