|
231 | 231 | continue |
232 | 232 | end |
233 | 233 | end |
234 | | - |
| 234 | + escapedonekey = regexprep(onekey, '(?<=[^\\]|^)\.', '\\.'); |
235 | 235 | if (ischar(onekey) && ~isempty(onekey) && onekey(1) == char(36)) |
236 | 236 | val = obj.call_('jsonpath', val, onekey); |
237 | | - trackpath = onekey; |
| 237 | + trackpath = escapedonekey; |
238 | 238 | elseif (isstruct(val)) |
239 | 239 | % check if struct array - if so, get field from all elements |
240 | 240 | if (numel(val) > 1 && isfield(val, onekey)) |
|
248 | 248 | % keep as cell if concatenation fails |
249 | 249 | end |
250 | 250 | end |
251 | | - trackpath = [trackpath '.' onekey]; |
| 251 | + trackpath = [trackpath '.' escapedonekey]; |
252 | 252 | % check if next operation is () for indexing the result |
253 | 253 | if (i < oplen && strcmp(idxkey(i + 1).type, '()') && ~isempty(idxkey(i + 1).subs)) |
254 | 254 | subsargs = struct('type', '()', 'subs', idxkey(i + 1).subs); |
|
259 | 259 | else |
260 | 260 | % single struct or scalar field access |
261 | 261 | val = val.(onekey); |
262 | | - trackpath = [trackpath '.' onekey]; |
| 262 | + trackpath = [trackpath '.' escapedonekey]; |
263 | 263 | end |
264 | 264 | elseif (isa(val, 'containers.Map') || isa(val, 'dictionary')) |
265 | 265 | val = val(onekey); |
266 | | - trackpath = [trackpath '.' onekey]; |
| 266 | + trackpath = [trackpath '.' escapedonekey]; |
267 | 267 | else |
268 | 268 | error('key name "%s" not found', onekey); |
269 | 269 | end |
|
322 | 322 | else |
323 | 323 | onekey = idx.subs; |
324 | 324 | end |
| 325 | + escapedonekey = regexprep(onekey, '(?<=[^\\]|^)\.', '\\.'); |
325 | 326 | if (ischar(onekey) && ~isempty(onekey)) |
326 | 327 | if (onekey(1) ~= char(36)) |
327 | | - temppath = [temppath '.' onekey]; |
| 328 | + temppath = [temppath '.' escapedonekey]; |
328 | 329 | else |
329 | | - temppath = onekey; |
| 330 | + temppath = escapedonekey; |
330 | 331 | end |
331 | 332 | end |
332 | 333 | end |
|
353 | 354 | else |
354 | 355 | onekey = idx.subs; |
355 | 356 | end |
| 357 | + escapedonekey = regexprep(onekey, '(?<=[^\\]|^)\.', '\\.'); |
356 | 358 | if (ischar(onekey) && ~isempty(onekey)) |
357 | 359 | if (onekey(1) ~= char(36)) |
358 | | - temppath = [temppath '.' onekey]; |
| 360 | + temppath = [temppath '.' escapedonekey]; |
359 | 361 | else |
360 | | - temppath = onekey; |
| 362 | + temppath = escapedonekey; |
361 | 363 | end |
362 | 364 | end |
363 | 365 | end |
|
0 commit comments