diff --git a/src/grib_dumper_class_json.c b/src/grib_dumper_class_json.c index a1e0b1e56..a63c24eaf 100644 --- a/src/grib_dumper_class_json.c +++ b/src/grib_dumper_class_json.c @@ -116,6 +116,7 @@ static void dump_values(grib_dumper* d,grib_accessor* a) long more=0; long count=0; int mydepth=depth+2; + double missing_value = 9999; count=grib_value_count(a); size=count; @@ -145,12 +146,20 @@ static void dump_values(grib_dumper* d,grib_accessor* a) fprintf(self->dumper.out,"%-*s",mydepth," "); fprintf(self->dumper.out,"\"%s\" : [ ",a->name); tab=lens+mydepth+7; - for (i=0;iparent->h, "missingValue", &missing_value); + for (i=0; icols || i==0) {fprintf(self->dumper.out,"\n%-*s",tab," ");count=0;} + if (values[i] == missing_value) + fprintf(self->dumper.out, "%s, ", "null"); + else fprintf(self->dumper.out,"%g, ",values[i]); count++; } if (count>cols) fprintf(self->dumper.out,"\n%-*s",tab," "); + if (values[i] == missing_value) + fprintf(self->dumper.out, "%s ","null"); + else fprintf(self->dumper.out,"%g ",values[i]); if (more) fprintf(self->dumper.out,"\n%-*s... %ld more values",tab," ",more); @@ -316,4 +325,3 @@ static void dump_section(grib_dumper* d,grib_accessor* a,grib_block_of_accessors grib_dump_accessors_block(d,block); } } - diff --git a/tools/grib_dump.c b/tools/grib_dump.c index 4658eb2d8..cdcbfb099 100644 --- a/tools/grib_dump.c +++ b/tools/grib_dump.c @@ -102,7 +102,8 @@ int grib_tool_init(grib_runtime_options* options) { if (grib_options_on("H")) options->dump_flags |= GRIB_DUMP_FLAG_HEXADECIMAL; - if (grib_options_on("d")) + /* In JSON mode we want to print all data values */ + if ( grib_options_on("d") || grib_options_on("j") ) options->dump_flags |= GRIB_DUMP_FLAG_ALL_DATA; return 0;