Skip to content

Unable to pass JSON Array as parameter #5

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

Closed
KyleLilly opened this issue Dec 16, 2015 · 3 comments · Fixed by #19
Closed

Unable to pass JSON Array as parameter #5

KyleLilly opened this issue Dec 16, 2015 · 3 comments · Fixed by #19
Labels

Comments

@KyleLilly
Copy link
Contributor

Currently it's not possible to pass a JSON array as a query parameter. This is due to the following function in util.js

if (_.isString(value) && value[0] === '[') {
    let arr = JSON.parse(value)
    if (_.isArray(arr)) {
        return arr
    }
}

Per a discussion on the node-postgres issue board brianc/node-postgres#442 - since arrays were around before json the preferred approach is to use JSON.stirngify() if you want to pass an array. This works in sails-postgres but fails in this updated knex based adapter.

@tjwebb
Copy link
Contributor

tjwebb commented Dec 16, 2015

So first of all, I'm pretty sure we went to Virginia Tech together :)

Secondly, yea that looks like an issue. If you think you have a quick fix, I'd be happy to merge a Pull Request.

@tjwebb tjwebb added the bug label Dec 16, 2015
@KyleLilly
Copy link
Contributor Author

Yeah BT Tracker - didn't realize it was you. I'll get a PR together once I get some tests written.

@tjwebb
Copy link
Contributor

tjwebb commented Dec 16, 2015

Haha awesome, thanks.

On Wed, Dec 16, 2015 at 2:03 PM, Kyle Lilly [email protected]
wrote:

Yeah BT Tracker - didn't realize it was you. I'll get a PR together once I
get some tests written.


Reply to this email directly or view it on GitHub
#5 (comment)
.

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

Successfully merging a pull request may close this issue.

2 participants