Write a JSON validator
PHP : 297 285 264 253 characters

&lt;?=preg_match(&lt;&lt;&lt;'R'
~([\h
]*)({(?1)((("([^"\\\0- ]| |\\(["\\/bfnrt]|u[\dA-Fa-f]{4}))*")(?1):(?1)((?5)|-?(0|[1-9]\d*)(\.\d+)?([Ee][+-]?\d+)?|(?2)|true|false|null))(((?1),(?1))(?4))*)?}|\[(?1)((?8)((?13)(?8))*)?(?1)])(?1)\z~A
R
,`cat`)?'Valid':'Invalid';


score: 300/300

This is a full, recursive implementation of the JSON grammar.

It works only on PHP ≥ 5.3 due to nowdoc syntax (heredoc would have required to double all \).

Readable version:

(this is the same regex, with named capture groups and extended syntax):

#!/usr/bin/env php
&lt;?php

$re = &lt;&lt;&lt; 'RE'
~\A (?P&lt;ws&gt;[\t\n\r ])* (
    (?P&lt;object&gt;\{ (?P&gt;ws)*
        (?P&lt;members&gt;
            (?P&lt;pair&gt;
                (?P&lt;string&gt;
                    "(?P&lt;char&gt;
                        [^"\\\x00-\x1F]
                        |\\(?P&lt;escape&gt;
                            ["\\/bfnrt]
                            |u [0-9A-Fa-f]{4}
                        )
                    )*"
                ) (?P&gt;ws)* : (?P&gt;ws)* (?P&lt;value&gt;
                    (?P&gt;string)
                    | (?P&lt;number&gt;-? (0 | [1-9][0-9]*) (\. [0-9]+)? ([Ee] [+-]? [0-9]+)? )
                    | (?P&gt;object)
                    | (?P&gt;array)
                    | true
                    | false
                    | null
                )
            ) ( (?P&gt;ws)* , (?P&gt;ws)* (?P&gt;pair) )*
        )?
    \})
    |(?P&lt;array&gt;\[ (?P&gt;ws)*
        (?P&lt;elements&gt;
            (?P&gt;value) ( (?P&gt;ws)* , (?P&gt;ws)* (?P&gt;value) )*
        )?
    (?P&gt;ws)* \])
) (?P&gt;ws)* \z~x
RE;

if (preg_match($re, stream_get_contents(STDIN))) {
    echo 'Valid';
} else {
    echo 'Invalid';
}