in reply to JSON decode problem

Vlad, this parses your string into a Perl hash, after doing some tweaking to your JSON string.

#!/usr/bin/perl use strict; use warnings; use JSON::PP; my $json_text = ''; # read string from __DATA__ while(<DATA>){ $json_text .=$_ } # work around javascript eval's $json_text =~ s/^(\w+:) \(.*$/"$1": 0, /gm; # fix date $json_text =~ s/:\s*new Date\((\d+)\)\s*/&epoch2timestring($1)/ge; # fix hashes $json_text =~ s/^(\w+:) "{(.*)}",/"$1": {$2}, /gm; # fix remaining fields (should be quotes) $json_text =~ s/^(\w+):/"$1":/gm; my $perl_scalar = JSON::PP->new->relaxed->allow_singlequote->allow_bar +ekey->loose->decode($json_text); use Data::Dumper; die Dumper($perl_scalar); sub epoch2timestring{ my ($e) = @_; $e=~s/.{3}$//; # eat 3 last digits my $result = scalar localtime($e); return ': "' . $result . '" '; # gmtime() ? } __DATA__ { is_touch: ('ontouchstart' in window), repository_urls: ["publisher_view2_videossp/PublisherView_videossp2"], origin_repository_url: "publisher_view2_videossp/PublisherView_videoss +p2", workbook_repo_url: "publisher_view2_videossp", publish_date: new Date(1431654084199), tabs_allowed: false, showTabsWorkbook: true, mobile_app_cookie: "", current_project_id: "7", current_sheet_name: "", current_sheet_type: "", current_workbook_name: "publisher_view2_videossp", current_workbook_id: "1548", current_view_id: "2713", sheetId: "PublisherView_videossp2", showParams: "{"revertType":null,"refresh":false,"checkpoint":false,"sh +eetName":"","unknownParams":"zone_id=6290&ac=a9aef098062f9646bd1638d0 +c6054c7b&account_id=62&Start_Date=2016-07-27&End_Date=2016-08-03","la +youtId":""}", stickySessionKey: "{"isAuthoring":false,"lastUpdatedAt":1470316180805, +"workbookId":1548}", }

edit: added missing "my" that got lost in copy/paste, now it runs...