I have 2 models.

JobCategory:

jobCategoryName=models.CharField(max_length=20)

JobProfile:

jobCategoryId=models.IntegerField()
title=models.CharField(max_length=50)
description=models.CharField(max_length=90)
salary=models.CharField(max_length=90)
qualification=models.CharField(max_length=90)
time=models.CharField(max_length=90)
location=models.CharField(max_length=90)
days=models.CharField(max_length=90)
experience=models.CharField(max_length=90)
active=models.BooleanField(default=True)

API request : GET /JobProfiles

How do I get the response in the format:

{
 jobCategory1: {
 title: string,
 description: string,
 location: string,
 salary: string,
 qualification: string,
 time: string,
 days: string,
 experience: string,
 active: boolean,
 slug: string,
 jobCategoryId: number,
 jobCategoryName: string
 }[],
 jobCategory2: {
 title: string,
 description: string,
 location: string,
 salary: string,
 qualification: string,
 time: string,
 days: string,
 experience: string,
 active: boolean,
 slug: string,
 jobCategoryId: number,
 jobCategoryName: string
 }[],
...
}

jobCategory1 and jobCategory2 are the alias of the job category names.

0 Answers