question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested objects with arrays

See original GitHub issue

Does the current validation process include handling the arrays ? I have nested user input similar to this (request body):

{ "person": { "name": "Mike", "emails": [ "aadsa@dsad", "a@a.com" ] } }

So using such validation rule should apply on the each array element, currently its not working such way:

req.checkBody('person.emails').isEmail()

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gustavohenkecommented, Oct 13, 2017

It’s possible, @LogansUA. You just have to make use of wildcards. As per the OP’s example, this would be person.emails.*.

0reactions
lock[bot]commented, Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I access and process nested objects, arrays, or JSON?
A nested data structure is an array or object which refers to other arrays or objects, i.e. its values are arrays or objects....
Read more >
How does Nested Array work in JavaScript? - eduCBA
Nested Array in JavaScript is defined as Array (Outer array) within another array (inner array). An Array can have one or more inner...
Read more >
Group objects inside the nested array JavaScript - Tutorialspoint
Group objects inside the nested array JavaScript - Let's say e have a parentArray that contains many sub arrays each of the same...
Read more >
Nested JavaScript Objects and Arrays. - W3Schools Tryit Editor
Nested JavaScript Objects and Arrays. Ford. Fiesta Focus Mustang. BMW. 320. X3 X5. Fiat. 500. Panda.
Read more >
Nested Objects and Arrays - VeeValidate
Similar to objects, you can also nest your values in an array, using square brackets just like how you would do it in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found