Peter, i had the same issue, i couldn't find the way to do it, but i hack my own writing like this
NDBFood>>neoJsonOn: neoJSONWriter "custom writing" neoJSONWriter writeMap: (OrderedDictionary new add: 'ndb_no' -> ndbno; add: 'full_name' -> name; add: 'food_group' -> fg; add: 'factors' -> self factors; add: 'nutrients' -> self nutrients; yourself) i just implement my own writing for my objects. HTH On Thu, Jun 30, 2016 at 12:06 PM, PBKResearch <pe...@pbkresearch.co.uk> wrote: > Hello > > > > I have recently used NeoJSON for the first time. All went pretty well, but > I would like to make a small tweak to the output, which probably involves > defining a mapping. I have read through the information in the NeoJSON pdf, > and also looked at the class comments, but I am a bit lost. Could Sven or > anyone please give me a hint? > > > > What I want is to construct a JSON object as a Pharo dictionary, but then > control the order in which the fields are output to the JSON file. Clearly > the order is irrelevant for a computer, but it could be helpful to a human > reader to put them in an order which reflects the way humans think about > the objects. The keys of a dictionary are of course unordered, so this is > not possible, but if we step back a bit we see that a dictionary is often > constructed from a collection of associations; if we could stop at this > stage, and have a mapping which outputs the associations in the order in > which they appear in the collection, this would give the control I am > looking for. > > > > Am I talking nonsense, or is there any way of implementing this using > NeoJSON mappings? > > > > Best wishes > > > > Peter Kenny > -- Bernardo E.C. Sent from a cheap desktop computer in South America.