DevConvert
Ruby on Rails

Converting ActiveRecord Objects to JSON

Copy Rails ActiveRecord objects and convert to JSON.

4 min readMarch 2026

When debugging Rails applications, you often copy objects from the Rails console:


#<User id: 1, name: "Rohith", email: "rohith@example.com", created_at: "2024-01-01 10:00:00">


This is an ActiveRecord object inspect output. DevConvert recognizes this format and converts it to clean JSON.


Example


Input (ActiveRecord Object):

#<User id: 1, name: "Rohith", email: "rohith@example.com", role: "admin", active: true>


Output (JSON):

{

"__class__": "User",

"id": 1,

"name": "Rohith",

"email": "rohith@example.com",

"role": "admin",

"active": true

}


Try it now

Use DevConvert to instantly convert your Ruby on Rails data. No signup required.