---------------------------
# File: JSON.pm
#
# Description: Read JSON files
#
# Notes: Set ExifTool MissingTagValue to "null" to ignore JSON nulls
#
# Revisions: 2017/03/13 - P. Ha
package Image::ExifTool::JSON;
use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Import;
$VERSION = '1.10';
sub ProcessJSON($$);
sub ProcessTag($$$$
OUPS => { 0 => 'JSON', 1 => 'JSON', 2 => 'Other' },
VARS => { NO_ID => 1 },
PROCESS_PROC => \&ProcessJSON,
NOTES => q{
Other than a few tags in the table below, JSON tags have not
qw($VERSION);
use Image::ExifTool;
$VERSION = '1.06';
sub ProcessLigoGPS($$$;$);
sub ProcessLigoJSON($$$);
sub OrderCipherDigits($$$;$);
my $knotsToKph = 1.852; # knots --> km/h
#-------------
--------------------------------------------------------
# Process GKU dashcam trailer containing JSON-format LigoGPS
# Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) tag table ref
# Returns: 1 on succes
os;
return ProcessLigoJSON($et, $dirInfo, $tagTbl);
}
#------------------------------------------------------------------------------
# Process LIGOGPSINFO data (non-JSON format)
# Inputs: 0) Exi
member, $iWorkType);
# special files to extract
my %extract = (
'meta.json' => 1,
'previews/preview.png' => 'PreviewPNG',
'preview.jpg' => 'PreviewI
$status and $et->Warn("Error extracting $file"), next;
if ($file eq 'meta.json') {
$et->ExtractInfo(\$buff, { ReEntry => 1 });
if ($$et{
json => {
Name => 'JSONData',
Flags => [ 'Binary', 'Protected', 'BlockExtract' ],
Notes => q{
by default, data in this tag is parsed using the ExifTool JSON mod
extracted as a block via the "JSONData" tag or by setting the API
BlockExtract option
},
SubDirectory => { TagTable => 'Image::ExifTool::JSON::Main' },
},
cbor =>
/;
return join '-', @a;
},
# seen:
# cacb/cast/caas/cacl/casg/json-00110010800000aa00389b71
# (also brob- but not yet tested)
# 6579d6fbdba2446bb2
;$);
sub EscapeJSON($;$);
# lookups for JSON characters that we escape specially
my %jsonChar = ( '"'=>'"', '\\'=>'\\', "\b"=>'b', "\f"=>'f', "\n"=>'n', "\r"=>'r', "\t"=>'t' );
my %jsonEsc = ( '"'=>
s
foreach $key (Image::ExifTool::OrderedKeys($obj)) {
my $hdr = $sfmt ? EscapeJSON($key) . ':' : $key . '=';
push @vals, $hdr . SerializeStruct($et, $$obj{$key}, '}');
ing (closing bracket plus "," and "|")
if ($sfmt) {
$rtnVal = EscapeJSON($obj, $sfmt eq 'JSONQ');
} else {
my $pat = $ket ? "\\$ket|,|\\|" : ',|\\|';
ExifTool
extracts the full JSON metadata blocks, as well as breaking them down into
individual tags. All available tags are extracted from the JSON metadata,
even if they don
't appear in the table below.
},
JSONMetadata => {
Notes => 'the full JSON-format metadata blocks',
Binary => 1,
List => 1,
},
EmbeddedImage => {
Notes
--------------------------------------------------------------------
# Extract tags from a parsed JSON hash
# Inputs: 0) ExifTool ref, 1) tag hash ref, 2) base tag name
sub ExtractTags($$$)
{
my (
able => 'string',
Protected => 1,
SubDirectory => { TagTable => 'Image::ExifTool::JSON::Main' },
},
0x9a00 => {
Name => 'XiaomiModel',
Writable => 'string',
sh::FLV Real::Media Real::Audio
Real::Metafile Red RIFF AIFF ASF TNEF WTV DICOM FITS XISF MIE JSON HTML
XMP::SVG Palm Palm::MOBI Palm::EXTH Torrent EXE EXE::PEVersion EXE::PEString
EXE::De
DWF DWG DXF WTV Torrent VCard
LRI R3D AA PDB PFM2 MRC LIF JXL MOI ISO ALIAS PCAP JSON MP3
TNEF DICOM PCD NKA ICO TXT AAC);
# file types that we can write (edit)
my @w
PS => ['JPEG', 'JPEG Stereo image'],
JPX => ['JP2', 'JPEG 2000 with extensions'],
JSON => ['JSON', 'JavaScript Object Notation'],
JUMBF=> ['JUMBF','JPEG Universal Metadata Box Format'],
--------------------------------------
# File: Import.pm
#
# Description: Import CSV and JSON database files
#
# Revisions: 2011-03-05 - P. Harvey Created
#--------------------------------
_OK);
$VERSION = '1.14';
@ISA = qw(Exporter);
@EXPORT_OK = qw(ReadCSV ReadJSON);
sub ReadJSONObject($;$);
my %unescapeJSON = ( 't'=>"\t", 'n'=>"\n", 'r'=>"\r", 'b' => "\b", 'f' => "\f" );
my $chars
# Read JSON object from file
# Inputs: 0) RAF reference or undef, 1) optional scalar reference for data
# to read before reading from file (ie. the file read buffer)
# Returns: JSON object
me::Stream',
ProcessProc => \&ProcessKenwood,
},
},{
Name => 'LigoJSON',
Condition => '$$valPt =~ /^LIGOGPSINFO \{/',
SubDirectory => {
TagT
e::ExifTool::QuickTime::Stream',
ProcessProc => 'Image::ExifTool::LigoGPS::ProcessLigoJSON',
},
},{
Name => 'GKUData',
Condition => '$$valPt =~ /^.{8}__V35AX_QV
ytes hex "05 00's..." (DuDuBell M1) "05 08 02 01 ..." (VSYS M6L)
gdat => { # Base64-encoded JSON-format timed GPS (Nextbase software)
Name => 'GPSData',
SubDirectory => {
# put IPTC after EXIF,
GPS => 'XMP', # etc...
Composite => 'Extra',
CBOR => 'JSON',
GeoTiff => 'GPS',
CanonVRD=> 'CanonCustom',
DJI => 'Casio',
FLIR => 'DJI
'highlights of HDR image',
Groups => { 2 => 'Preview' },
Binary => 1,
},
JSONInfo => { },
HiddenData => {
Notes => 'hidden in EXIF, not in trailer. This data is l
, 2 => 'Image' },
NOTES => 'Information written in JPEG trailer by some OnePlus phones.',
JSONInfo => { },
'private.emptyspace' => { # length of the entire OnePlus trailer
Name =>
ue looking for Vivo JSON data
if ($buff =~ /vivo\{"/g) {
my $jsonStart = pos($buff) - 2;
if ($buff =~ /\}\0/g) {
my $jsonLen = pos($buff) - 1 - $jsonStart;
л перезапуска JPEG',
'JPEGTables' => 'JPEG-таблицы',
'JSONMetadata' => 'Метаданные JSON',
'JobID' => 'ID задания',
'JobTitle' => 'Должность',
------------------------------------------------------------
# Process 'gdat' atom Base64-encoded JSON-format timed GPS used by Nextbase software (ref PH)
# Inputs: 0) ExifTool ref, 1) dirInfo ref, 2)
Pt);
my (%dbase, $fix);
require Image::ExifTool::Import;
Image::ExifTool::Import::ReadJSON($dataPt, \%dbase);
my $info = $dbase{'*'} or return 0;
$et->HandleTag($tagTbl, CameraMode
$plistType{$tag}) if $plistType{$tag} and $$et{FILE_TYPE} eq 'XMP';
# handle compressed PLIST/JSON data
my $proc;
if ($$tagInfo{CompressedPLIST} and ref $val eq 'SCALAR' and $$val !~ /^bpl
-----------------------------------------
# Extract information from a PLIST file (binary, XML or JSON format)
# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
# Returns: 1 on succes
} elsif ($$dataPt =~ /^\{"/) { # JSON PLIST
$raf and $raf->Seek(0);
require Image::ExifTool::JSON;
$result = Image::ExifTool::JSON::ProcessJSON($et, $dirInfo);
} elsif ($$e
Info',
Description => 'PEg Info',
SubDirectory => { TagTable => 'Image::ExifTool::JSON::Main' },
},
# 0x0da1-name - seen 'Captured_App_Info' #forum16086
# 0xa050-name - seen
e strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::JSON;
$VERSION = '1.03';
sub ProcessCBOR($$$);
sub ReadCBORValue($$$$);
# optional CBOR type code
m
ormat' => 'Format',
# my sample file has the following 2 tags in CBOR, but they should be JSON
authorName => { Name => 'AuthorName', Groups => { 2 => 'Author' } },
authorIdentifie
Tool::JSON::ProcessTag($et, $tagTablePtr, $tag, $$val{$tag});
}
} elsif (ref $val eq 'ARRAY') {
for ($i=0; $i<@$val; ++$i) {
Image::ExifTool::JSON::Proc
ead Google Takeout JSON files
# 2024/04/23 - PH Added ability to read more OpenTracks GPS tags
# 2024/08/28 - PH Added support for new Google Takeout JSON format
#
4/11/05 - PH Added support for Google Maps "Export timeline data"
# JSON format
#
# References: 1) http://www.topografix.com/GPX/1/1/
# 2) http://www.gpsi
aceVisit|activitySegment|latitudeE7)"\s*:/) {
# Google Takeout JSON format
$format = 'JSON';
$sortFixes = 1; # (fixes are not all in order for this form
3G2 r/w | DSS r | JPEG r/w | ODT r | RW2 r/w
3GP r/w | DV r | JSON r | OFR r | RWL r/w
7Z r | DVB r/w | JXL r/w | OGG r | RWZ
- Default ExifTool format
JSON - JSON format
JSONQ - JSON with quoted numerical values
Note that the JSONQ setting causes all values in the exiftool application
-json output to be quoted, regard
eoTiff, GIF, GIMP,
GM, GoPro, H264, HTML, ICC_Profile, ID3, IPTC, ISO, ITC, JFIF, JPEG,
Jpeg2000, JSON, JUMBF, Leaf, LNK, Lytro, M2TS, MakerNotes, Matroska, Meta,
MIE, MIFF, MISB, MNG, MOI, MPC, MPEG,