jsontsv 0.1.4.6 → 0.1.5.0
raw patch · 3 files changed
+23/−1 lines, 3 files
Files
- Main.hs +7/−0
- README.md +15/−0
- jsontsv.cabal +1/−1
Main.hs view
@@ -197,10 +197,17 @@ Just e' -> evalKeyPath config ks e' Nothing -> Null -- traverse array elements with additional keys+-- if key is _, e.g. cast._[0] , traverse INTO each array object+-- e.g. "cast":[["Michael Caine",13473],["Demi Moore",65231],...+evalKeyPath config@Config{..} (Key "_":ks) (Array v) = + String . mconcat . intersperse arrayDelim $ map (evalToText config ks) (V.toList v)+-- traverse array elements with additional keys+ evalKeyPath _ ks@(Key key:_) (Array v) | V.null v = Null evalKeyPath config@Config{..} ks@(Key key:_) (Array v) = let vs = V.toList v in String . mconcat . intersperse arrayDelim $ map (evalToText config ks) vs+ evalKeyPath _ ((Index _):_) _ = Null evalKeyPath _ _ _ = Null
README.md view
@@ -78,6 +78,21 @@ Interstellar 2014 Matthew McConaughey,Anne Hathaway 8.9 ``` +## Mapping an array index getter over nested arrays++As of version 0.1.5.0, you can map an index getter over arrays, such as this++ {"id":2,"cast":[["Michael Caine",13473],["Demi Moore",65231]]}++with this expression++ jsontsv -a '|' 'cast._[0]'++This results in:+ + 2 Michael Caine|Demi Moore++ ## Installation Assuming you have a recent version of the [Haskell
jsontsv.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: jsontsv-version: 0.1.4.6+version: 0.1.5.0 synopsis: JSON to TSV transformer homepage: https://github.com/danchoi/jsontsv description: Transforms JSON into tab-separated line-oriented output, for easier processing in Unix-style pipelines.