Match JSON even when Piwik does not send an array

Added regexps to match both [ and {. 
Also removed a duplicate trim().