From: Martin A. H. <ma...@ma...> - 2009-11-16 14:05:30
|
Hello, I am wondering why Jbrowse files like refSeqs.js and trackInfo.js are not in JSON format, but rather have a variable name, an equal sign, and then, on the following lines, a block of JSON code: refSeqs = [ { "length" : 50001, "name" : "ctgA", "seqDir" : "data/seq/ctgA", "seqChunkSize" : 20000, "end" : 50001, "start" : 0 } ] Why not encode the entire thing in JSON? { "refSeqs" : [ { "length" : 50001, "name" : "ctgA", "seqDir" : "data/seq/ctgA", "start" : 0, "end" : 50001, "seqChunkSize" : 20000 } ] } Below is a little test. Cheers, Martin #!/usr/bin/env perl use warnings; use strict; use JSON; use Data::Dumper; my ( $json, $data ); local $/ = undef; $json = <DATA>; $data = JSON::from_json( $json ); print Dumper( $data ); __DATA__ { "refSeqs" : [ { "length" : 50001, "name" : "ctgA", "seqDir" : "data/seq/ctgA", "start" : 0, "end" : 50001, "seqChunkSize" : 20000 } ] } |