Free Online Tool
Rails ActiveRecord to JSON Converter
Convert Rails ActiveRecord object output to JSON. Paste #<User id: 1, name: "Alice"> style output from your Rails console or logs and get clean JSON instantly.
Try sample:
Input
Output
Output will appear here
Press ⌘ Enter to convert
How It Works
- 1Copy ActiveRecord inspect output from your Rails console or log
- 2Paste into the converter
- 3Get a clean JSON object with all attributes
Examples
User model
Input
#<User id: 1, name: "Alice", email: "[email protected]", active: true>
Output
{
"id": 1,
"name": "Alice",
"email": "[email protected]",
"active": true
}With timestamps
Input
#<Post id: 5, title: "Hello", published: true, created_at: "2024-01-01 00:00:00">
Output
{
"id": 5,
"title": "Hello",
"published": true,
"created_at": "2024-01-01 00:00:00"
}Frequently Asked Questions
What is ActiveRecord inspect output?
When you call User.first or print an ActiveRecord object in the Rails console, Ruby outputs #<User id: 1, name: "Alice", …>. This is the AR inspect format.
Does it handle ActiveRecord::Relation output?
Yes. DevConvert also has a dedicated ActiveRecord::Relation mode for [#<User …>, #<User …>] array-style output.
What about Rails DateTime fields?
DateTime values like Mon, 01 Jan 2024 00:00:00.000000000 UTC +00:00 are preserved as strings in the JSON output.