Hi Jeremy,

The desired output would be a Ruby Hash like 
{"id":1,"a2s":[{"id":1,"a1_id":1,"a3s":[{"id":1,"a2_id":1,"a4s":[{"id":1,"a3_id":1}]}]}]}

Essentially, it's the JSON from the "A1#to_json" example, but with 
JSON.parse run on that output.

Let's zoom out for a moment though.  What I'm _trying_ to do is get data 
out of PostgreSQL in the form of a JSON document that can be fed directly 
into MongoDB or some other document database.  Ruby Sequel is a _great_ way 
to get this done in a quick and easy fashion, but its turning out to be 
very slow.

I'm now looking into using PostgreSQL's Array and JSON operators to group 
rows together into arrays and nest those arrays inside other rows.  I 
imagine Ruby Sequel can help me out here too, but I'm getting in over my 
head.

Thanks,
Ryan
On Wednesday, February 3, 2021 at 2:17:47 PM UTC-8 Jeremy Evans wrote:

> On Wed, Feb 3, 2021 at 11:42 AM aguynamedryan <[email protected]> wrote:
>
>> I hope it's not bad form to dig up an old conversation but I'm having a 
>> similar issue under Sequel 5.41
>>
>> The block from to_json yields Sequel::Plugins::JsonSerializer::Literal 
>> objects for nested associations but I'd like associations and nested 
>> associations to be plain old Ruby Hashes.
>>
>
> Hi Ryan,
>
> Can you provide the output you want to generate for the example, just so 
> I'm clear?
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/85d0ebff-fcbf-453a-8628-f153eb847f50n%40googlegroups.com.

Reply via email to