Questions tagged [jbuilder]

JBuilder is a IDE for Java developed by Embarcadero Technologies. It is also the name of a Ruby library for producing JSON.

JBuilder is a Java IDE from Embarcadero Technologies. It was originally developed by Borland in 1997, and now belongs to Embarcadero Technologies.

Jbuilder is also the name of a Ruby library that lets you "create JSON structures via a Builder-style DSL".

335 questions
6
votes
1 answer

Rails jbuilder remove header

I'm adding jbuilder to a Rails app -- great tool! I'm getting the list of records I want, but it has extra output I don't want. This is the jbuilder code: json.locations @locations do |location| json.id location.id json.name location.name end The…
Reddirt
  • 5,913
  • 9
  • 48
  • 126
6
votes
6 answers

Pretty Print JSON generated with a jbuilder template in Rails 3.2.8

Anyone have a way to pretty print JSON output from jbuilder? I can pretty print JSON generated within a controller action with something like: JSON.pretty_generate(some_json_object) but once I pass off to a jbuilder template, I'm not aware of a…
idStar
  • 10,674
  • 9
  • 54
  • 57
6
votes
1 answer

HAML prevents template engines to render anything else than HTML

I am using Jbuilder (and I also tried to use Rabl) to render json. When I try to render the jbuilder template in my application it renders the template within the layouts/application file and returns HTML as JSON (see line 'within…
Flov
  • 1,527
  • 16
  • 25
5
votes
2 answers

Basic usage of Jbuilder in a controller

In a Rails (5.2) app, I'm trying to use JBuilder to return some JSON as response. I have added JBuilder in my Gemfile. # Gemfile ... gem 'jbuilder', '~> 2.5' ... # Gemfile.lock ... jbuilder (2.8.0) ... According to JBuilder documentation: You can…
Sig
  • 5,476
  • 10
  • 49
  • 89
5
votes
3 answers

Automatically convert hash keys to camelCase in JBuilder

I am using JBuilder version 2.4.1 and Rails 4.2.6. I am trying to serialize a complex object to JSON. The code looks as follows: json.key_format! camelize: :lower json.data_object @foo @foo looks like this: { key: 'value', long_key:…
Morozzzko
  • 580
  • 5
  • 12
5
votes
2 answers

jbuilder with If Condition

I am trying to display a key-value pair on some condition in the jbuilder like as follows json.id plan.id json.title plan.title json.description plan.description json.plan_date plan.plan_date.iso8601 json.start_time plan.start_time.strftime("%I:%M…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
5
votes
1 answer

JBuilder json keys with @ symbol to use schema.org metadata using json-ld

In my jbuilder template I'm not able to have keys starting with "@" symbol. e.g. "@context". What should I do. I need keys like this for json-ld metadata in my application. I want to get json like below