From 63534ec1dc0c0160cd2a8ebcd3f1c2baf2cb305e Mon Sep 17 00:00:00 2001 From: StephaneDucasse Date: Mon, 23 Feb 2015 09:38:01 +0100 Subject: [PATCH] adding free style hakcing in both --- NeoCSV/NeoCSV.pier | 16 ++++++++++++++++ NeoJSON/NeoJSON.pier | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/NeoCSV/NeoCSV.pier b/NeoCSV/NeoCSV.pier index 93dd7b8..6366a66 100644 --- a/NeoCSV/NeoCSV.pier +++ b/NeoCSV/NeoCSV.pier @@ -229,6 +229,22 @@ Array streamContents: [ :out | ]]] +!! Without Mapping Definition + +Both NeoCSV and NeoJSON can operate in two ways, (1) without the definition of any schema's or (2) with the definition of schema's and mappings. Therefore you can use them both using a quick and dirty explore style. Here are some examples: + +[[[ +'my-data.csv' asFileReference readStreamDo: [ :in | (NeoCSVReader on: in) upToEnd ]. + + -> an array of arrays +]]] + +[[[ +'my-data.json' asFileReference readStreamDo: [ :in | (NeoJSONReader on: in) next ]. + + => objects structured using dictionaries and arrays +]]] + !! Conclusion NeoCSV provides a good support to emit or import comma separated data. diff --git a/NeoJSON/NeoJSON.pier b/NeoJSON/NeoJSON.pier index f374568..314f943 100644 --- a/NeoJSON/NeoJSON.pier +++ b/NeoJSON/NeoJSON.pier @@ -221,6 +221,23 @@ instead of: {} ]]] +!! Without Mapping Definition + +Both NeoCSV and NeoJSON can operate in two ways, (1) without the definition of any schema's or (2) with the definition of schema's and mappings. Therefore you can use them both using a quick and dirty explore style. Here are some examples: + +[[[ +'my-data.csv' asFileReference readStreamDo: [ :in | (NeoCSVReader on: in) upToEnd ]. + + -> an array of arrays +]]] + +[[[ +'my-data.json' asFileReference readStreamDo: [ :in | (NeoJSONReader on: in) next ]. + + => objects structured using dictionaries and arrays +]]] + + !! Conclusion NeoJSON is a powerful library to convert objects. Now Sven developed STON (Smalltalk object notation) which is closer to Pharo syntax and handles cycles and references between serialized objects.