@@ -128,21 +128,28 @@ export class MVTSource extends NetworkTileSource {
128128 parseJSONProperties ( feature ) {
129129 if ( this . parse_json_type !== PARSE_JSON_TYPE . NONE ) {
130130 const props = feature . properties ;
131- for ( const p in props ) {
132- // if specified, check list of explicit properties to parse
133- // (otherwise try to parse all properties)
134- if ( this . parse_json_type === PARSE_JSON_TYPE . SOME &&
135- this . parse_json_prop_list . indexOf ( p ) === - 1 ) {
136- continue ; // skip this property
137- }
138131
139- // check if this property looks like JSON, and parse if so
140- if ( PARSE_JSON_TEST . indexOf ( props [ p ] [ 0 ] ) > - 1 ) {
132+ // if specified, check list of explicit properties to parse
133+ if ( this . parse_json_type === PARSE_JSON_TYPE . SOME ) {
134+ this . parse_json_prop_list . forEach ( p => {
141135 try {
142136 props [ p ] = JSON . parse ( props [ p ] ) ;
143137 } catch ( e ) {
144138 // continue with original value if couldn't parse as JSON
145139 }
140+ } ) ;
141+ }
142+ // otherwise try to parse all properties
143+ else {
144+ for ( const p in props ) {
145+ // check if this property looks like JSON, and parse if so
146+ if ( PARSE_JSON_TEST . indexOf ( props [ p ] [ 0 ] ) > - 1 ) {
147+ try {
148+ props [ p ] = JSON . parse ( props [ p ] ) ;
149+ } catch ( e ) {
150+ // continue with original value if couldn't parse as JSON
151+ }
152+ }
146153 }
147154 }
148155 }
0 commit comments