Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON key starting with numeric value throwing error. #228

Open
clifrocks311 opened this issue Oct 17, 2024 · 0 comments
Open

JSON key starting with numeric value throwing error. #228

clifrocks311 opened this issue Oct 17, 2024 · 0 comments

Comments

@clifrocks311
Copy link

Describe the bug

Getting this error when running:
JSONPath( $..returnDetails[0].rateOfReturn.1dCload (path),
rateOfReturn: {
'1dCload': 'string',
'1dCnoload': 'string',
'5dCLoad': 'string',
'5dCNoload': 'string',
'7dCLoad': 'string',
'7dCNoload': 'string',
'1mCLoad': 'string',
'1mCNoload': 'string',
'3mCLoad': 'string',
'3mCNoload': 'string',
'6mCLoad': 'string',
'6mCNoload': 'string',
'9mCLoad': 'string',
'1yCLoad': 'string',
'1yCNoload': 'string',
'2yALoad': 'string',
'2yANoload': 'string',
'2yCLoad': 'string',
'2yCNoload': 'string',
'3yALoad': 'string',
'3yANoload': 'string',
'3yCLoad': 'string',
'3yCNoload': 'string',
'4yALoad': 'string',
'4yANoload': 'string',
'4yCLoad': 'string',
'4yCNoload': 'string',
'5yALoad': 'string',
'5yANoload': 'string',
'5yCLoad': 'string',
'5yCNoload': 'string',
'6yALoad': 'string',
'6yANoload': 'string',
'6yCLoad': 'string',
'6yCNoload': 'string',
'7yALoad': 'string',
'7yANoload': 'string',
'7yCLoad': 'string',
'7yCNoload': 'string',
'8yALoad': 'string',
'8yANoload': 'string',
'8yCLoad': 'string',
'8yCNoload': 'string',
'9yALoad': 'string',
'9yANoload': 'string',
'9yCLoad': 'string',
ror_9yCNoload: 'string',
'10yALoad': 'string',
'10yANoload': 'string',
'10yCLoad': 'string',
'10yCNoload': 'string',
'15yALoad': 'string',
'15yANoload': 'string',
'15yCLoad': 'string',
'15yCNoload': 'string',
'20yALoad': 'string',
'20yANoload': 'string',
'20yCLoad': 'string',
'20yCNoload': 'string',
mtdCLoad: 'string',
mtdCNoload: 'string',
qtdCLoad: 'string',
qtdCNoload: 'string',
ytdCLoad: 'string',
ytdCNoload: 'string',
fytdIdxCLoad: 'string',
fytdIdxCNoload: 'string',
advIncpALoad: 'string',
advIncpANoload: 'string',
advIncpCLoad: 'string',
advIncpCNoload: 'string',
idxfIncpALoad: 'string',
idxfIncpANoload: 'string',
idxfIncpCLoad: 'string',
idxfIncpCNoload: 'string',
idxfNonsincpALoad: 'string',
idxfNonsincpANoload: 'string',
idxfNonsincpCLoad: 'string',
idxfNonsincpCNoload: 'string',
idxfSincpALoad: 'string',
idxfSincpANoload: 'string',
idxfSincpCLoad: 'string',
idxfSincpCNoload: 'string',
nonSincpALoad: 'string',
nonSincpANoload: 'string',
nonSincpCLoad: 'string',
nonSincpCNoload: 'string',
incpALoad: 'string',
incpANoload: 'string',
incpCLoad: 'string',
incpCNoload: 'string',
sincpALoad: 'string',
sincpNoload: 'string',
sincpCLoad: 'string',
sincpCNoload: 'string',
'6mtdCLoad': 'string',
'6mtdCNoload': 'string',
fytdCLoad: 'string',
fytdCNoload: 'string'
}
}

{
"errors": [
{
"message": "Parse error on line 1:\n...ls[0].rateOfReturn.1dCload\n-----------------------^\nExpecting 'DOT', 'DOT_DOT', '[', got 'IDENTIFIER'",
"name": "Error",
"stack": "Error: Parse error on line 1:\n...ls[0].rateOfReturn.1dCload\n-----------------------^\nExpecting 'DOT', 'DOT_DOT', '[', got 'IDENTIFIER'\n at Parser.parseError (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/jsonpath/generated/parser.js:166:15)\n at Parser.parser.yy.parseError (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/jsonpath/lib/parser.js:13:17)\n at Parser.parse (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/jsonpath/generated/parser.js:224:22)\n at JSONPath.nodes (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/jsonpath/lib/index.js:118:26)\n at JSONPath.apply (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/jsonpath/lib/index.js:36:20)\n at modifyResponsePayload (/Users/cxho3/Sandbox/service-virtualization-framework/lib/util/modifyGetResultset.js:949:20)\n at Object.selectFromDB (/Users/cxho3/Sandbox/service-virtualization-framework/lib/util/modifyGetResultset.js:1075:27)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async virtualizeAPI (eval at (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/mountebank/src/models/responseResolver.js:63:34), :165:58)\n at async Object.resolve (/Users/cxho3/Sandbox/service-virtualization-framework/node_modules/mountebank/src/models/responseResolver.js:345:24)"
}
]
}

Code sample or steps to reproduce

// Code that reproduces problem here

Console error or logs

Expected behavior

expect [ 'string' ]

Expected result

[ 'string' ]

Environment (IMPORTANT)

"jsonpath-plus": "^10.0.4",

Desktop**

Mac
Node v22.9.0

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant