Comments (2)
Hi @dwarthen-tnn, thanks for reporting this. The error that you're seeing (TypeError: kp.slice is not a function
) is because the package doesn't currently support any RegExps in the keys
option. As noted in the README, the keys
option currently just supports either an array of strings or objects in this format:
{
"field": string, // required
"title": string, // optional
"wildcardMatch": boolean, // optional - default: false
}
If I'm understanding your use case correctly, you're essentially looking for a way to specify a custom title for some keys while still including all of the auto-detected keys in the generated CSV. Is that accurate? If so, I think this should be possible to support by refactoring how the titles are specified. That seems like it's probably the best way to handle this type of use case, and could also be setup to handle the title prefixing for wildcardMatch
ed keys desired in #247 too.
from json-2-csv.
Hi @dwarthen-tnn, thanks for reporting this. The error that you're seeing (
TypeError: kp.slice is not a function
) is because the package doesn't currently support any RegExps in thekeys
option. As noted in the README, thekeys
option currently just supports either an array of strings or objects in this format:
I think my confusion arose because VS code was assuring me that RegExp was a valid type for the field property, but today I'm not able to replicate that or find any place in the types definitions where that could have come from.
If I'm understanding your use case correctly, you're essentially looking for a way to specify a custom title for some keys while still including all of the auto-detected keys in the generated CSV. Is that accurate?
Yes, that's essentially it. I've worked around this on my end by changing the titles of those fields in my code before they reach the Converter. Not ideal for my use case but it works OK.
Thank you for your reply!
from json-2-csv.
Related Issues (20)
- Headerless CSV HOT 3
- Incorrect parsing of wrapped values HOT 5
- Custom sorting of headers HOT 2
- How to properly change mongoDB timestamp to proper date? HOT 1
- TypeError: Cannot convert undefined or null to object HOT 1
- Private Vulnerability Disclosure HOT 1
- csv2json Allow CSV Files Without Headers HOT 3
- NestedDotKeys with false and 0 are returned as undefined HOT 4
- prependHeader: false, is not working HOT 2
- Paginated conversion ? HOT 1
- "expandArrayObjects" option not behaving as expected HOT 3
- sync version HOT 2
- Incorrect parsing of wrapped values when the new line is right after the starting quote HOT 1
- Ignoring an entire array with `excludeKeys` and `expandArrayObjects` HOT 2
- No possibility to use unescaped dots in headers HOT 11
- Feature Request: expandNestedObjects functionality with keys HOT 10
- Add support for RegExps in excludeKeys
- Field in CSV it turned into an object unexpectedly. HOT 2
- why json to csv adds `\` before `.` in headers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-2-csv.