add tag
I've got some [mongoexport] output I'd like to quickly parse. As you know, this output is pseudo-json in style. Mine looks like this:


I'm pretty sure the object `b932` exists in there somewhere, and since each line is a discrete json document, I'll [grep] for it and pipe the output into [ConvertFrom-Json]. 

![Screenshot 2020-06-12 at 12.42.26.png](/image?hash=49f3d9effa2c15a7037a64a44e18021513bf6482c59e96e80e71d2e342dc8c0e)

Easy peasy, I can see in the object level preview that the grep colorisation was preserved in the pipeline. That's fun and unexpected I guess, but I do have `export GREP_OPTIONS='--color=always'` in my `.bash_profile` which was the environment I was in before `pwsh`, so fair enough, I guess it got inherited ¯\\\_(ツ)_/¯

Anyway... let's see what the data for `b932` is...

![Screenshot 2020-06-12 at 12.48.57.png](/image?hash=8ddd132d078a4a08c1d0527273f3469f22d716a3beadf8127679a62e5d5a40ae)

...huh? What's going on, the docs are here, right...?

![Screenshot 2020-06-12 at 12.49.32.png](/image?hash=7d625c7063286d7a89049bb5cc2bc8d9abf9af37e550163380ea072086738b01)


Anyway, it turns out you cannot index into document `b392` in any of the "usual" ways here


Additionally [Get-Member] shows some... interesting output here too. 

![Screenshot 2020-06-12 at 12.53.34.png](/image?hash=1b515808676b28ed9fdbf25d0191ba994fcd196646fff5f06c56169e835c485b)

So... _what's going on!?_

Top Answer
As a workaround, use `--color=none` to strip the colour from the left side of your pipeline before converting the object.

[3.61ms] /Users/pvandivier/Desktop
PS> $object = grep b932 ./foo.dump --color=none | ConvertFrom-Json
[40.4ms] /Users/pvandivier/Desktop
PS> $


[3.45ms] /Users/pvandivier/Desktop

To improve `grep` usability in general, you can change your `.bash_profile` to specify `export GREP_OPTIONS='--color=auto'` (instead of `always`) which will not colourise output that is redirected or otherwise post-processed. Hat tip to []( - I'm not able to find that exact or similar verbiage on any of the online `grep` man pages I've checked.

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.