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

Add support to change Separator character #624

Closed
brentpi opened this issue Oct 12, 2016 · 5 comments
Closed

Add support to change Separator character #624

brentpi opened this issue Oct 12, 2016 · 5 comments

Comments

@brentpi
Copy link

brentpi commented Oct 12, 2016

By default in ObjectMapper, the Separator character used to navigate to sub-objects is ".", and the user is required to disable nesting if their object contains keys with a ".".

Potentially abstract the Separator character to a variable, so the user can change it to "|" or something less likely in their use case.

@devxoul
Copy link
Contributor

devxoul commented Oct 12, 2016

@brentpi, you can use property <- map["my.key", nested: false] instead.

@brentpi
Copy link
Author

brentpi commented Oct 12, 2016

My original data source is a bunch of OS X System Profiler Plist files that I'm reading into a dictionary. The format for SPStorageDataType is something like the following, so you can see why I requested this:

_items.0."com.apple.corestorage.lv"."com.apple.corestorage.lv.encrypted"

So, for my use case, changing the '.' to a '/' or a '|' would be helpful, as I would like to maintain nesting, but ignore the "com.apple.corestorage.lv" keys as "nested" keys.

@devxoul
Copy link
Contributor

devxoul commented Oct 12, 2016

@brentpi That makes sense. How about this approach? It allows to pass delimiter parameter to map[] subscription.

property <- map["_items -> 0 -> com.apple.corestorage.lv -> com.apple.corestorage.lv.encrypted", delimiter: " -> "]

@brentpi
Copy link
Author

brentpi commented Oct 12, 2016

Yeah, that sounds like a better option perhaps.

@devxoul
Copy link
Contributor

devxoul commented Oct 15, 2016

@brentpi, #629 is for you 🎉

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

3 participants