Forum: Ruby on Rails JSON Array in Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee97889c7748992d9dfa43499311f7cc?d=identicon&s=25 Tom DD (tomdde)
on 2017-01-31 09:10
i created this JSON in Rails with "render json:"
[{"id":1,"name":"Test1","set":"A"}]

but the right JSON is
{"my":[{"id":1,"name":"Test1","set":["1","2"]}]}

How can i add "my" as a hash?

How can i create a array in database with the "set" array?

Thanks.
This topic is locked and can not be replied to.