Ruby library for generating JSON. JSON:API serializer for Ruby Object, built by Netflix.
Questions tagged [fastjsonapi]
44 questions
8
votes
3 answers
Rails: NameError (uninitialized constant UserSerializer)
I am currently building a Rails API-only application using Rails 6.0. I am using fast_jsonapi for JSON:API serialization of Ruby Objects. For now I have created only the UsersController.
I have a user model with the following…

Promise Preston
- 24,334
- 12
- 145
- 143
7
votes
3 answers
How to get the fast_jsonapi to return the attributes of the relationships
I have a rails api with a number of models that are being serialized by the fast_jsonapi gem.
This is what my models look like:
class Shift < ApplicationRecord
belongs_to :team, optional: true
...
class Team < ApplicationRecord
has_many…

ilrock
- 573
- 8
- 24
3
votes
2 answers
Pass current_user and links together in fast_jsonapi, in rails
Rails version : 6.0.0
Ruby version : 2.6.3
controller
render json: AreaSerializer.new(
Area.all, paginate(pagy), params: { current_user: current_user }
), status: ok
serializer
attributes :nodes do |area,…

Srimathi G
- 71
- 5
3
votes
2 answers
How to pass parameters from controller to serializer in FastJsonAPI?
I have a controller method drop_down_values in which I select a set of values and respond in json ,building the object using a serializer. I am using FastJson Api. I want to know , how can I access other variables present in the controller in the…

Nandhini
- 645
- 7
- 21
2
votes
1 answer
Rails Fast Json API includes scope
In my Rails 6/Grape API app I've got a serializer where I want to include only active journeys (by active I mean journey.is_deleted: false). Current endpoint looks like:
helpers do
def query
…

mr_muscle
- 2,536
- 18
- 61
2
votes
1 answer
Is there a way to select just one attribute of an outer object by using the Fast JSON API in Rails?
I am creating a travel app which uses a backend Rails API. I've decided to use the Fast JSON API to serialize my data. I have a list of countries; each country has many cities, and each city has many attractions.
These are a list of my associations…

Blake
- 23
- 3
2
votes
2 answers
how to change response format from fast_jsonapi format to AMS gem response format
I want to change The response format of fast_jsonapi gem from:
{
"data": {
"id": "8",
"type": "directory",
"attributes": {
"firstname": "Naoufal",
"lastname": "Huster",
}
}
}
To…

Naoufal El Hassnaoui
- 25
- 5
2
votes
0 answers
How to have 2 different serializer for STI models in Fast Json Api or Active Model Serializer
I have a workflow model and 2 types of workflows
normal_workflow
special_workflow
There is a project model which is related to the workflow model using has_many/belongs_to association.
Now for getting all the workflows of a project, we have a…

Vivek Tiwary
- 180
- 1
- 9
1
vote
1 answer
jsonapi::Serializer Specify Foreign Key in Association belongs_to / has_many
I have a database that I cannot modify as it is a read-only populated from a node I don't control.
This causes the tables to have foreign_keys that are different from the Rails default way.
You can see the current situation in the models below:
#…

user3755529
- 1,050
- 1
- 10
- 30
1
vote
0 answers
JSON API standard: how to associate data that isn't saved and has no id (yet)?
In my rails app I send data to the react front end in JSON API standard format via the jsonapi-serializer gem. This works well for data coming from our database, but when we have failing form data, which is sent in the form of rails nested…

pixelearth
- 13,674
- 10
- 62
- 110
1
vote
1 answer
How to cache a rails api controller
I'm seeing some performance issues in my application and was wondering whether my cache was working properly or if I misunderstood / misconfigured anything. I'm using fast-jsonapi for serialization which comes with a built-in caching option.
Let's…

Luc
- 13
- 1
- 4
1
vote
0 answers
How to organize serializers using fastjsonapi.?
My application has following versions: rails 6.0.0, ruby 2.6.3.
I have around 20 controllers in the application and we have planned to use fast-json-api instead of rabl as serializer in the app. I found the number of serializer files growing very…

Srimathi G
- 71
- 5
1
vote
1 answer
rails Netflix fast_jsonapi to pick serializer automatically
I using grape for apis with fast_jsonapi and
What I see that I have to always provide serializer name like
CompanySerializer.new(Company.all).serializable_hash
wondering if it can auto pick serialzier name depending upon resource name or object…

Muhammad Faisal Iqbal
- 1,796
- 2
- 20
- 43
1
vote
1 answer
How to reject the attributes in fastjson_api?
I'm started using fastjson_api, I have implemented attribute-based control in my project how do reject the attributes when I'm returning the JSON data.
For Example:-
I have a customer table where it has customer name, email, phone, address
For some…

Rahul
- 170
- 1
- 3
- 14