Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
How can i send array of object in postman?

I have this schema and whenever i try to post request using postman, it returns me error as basic is of required type "String" but i have defined it as number. I am also having trouble posting array of objects for bonuses and deductable. It is posting empty array. What is the way to post array of objects in postman?

const LevelSchema = new Schema({
  name: {
    type: String,
    required: true
  },
  description: {
    type: String
  },
  basic: {
    type: Number,
    required: true
  },
  bonuses: [
    {
      name: {
        type: String,
        required: true
      },
      amount: {
        type: Number,
        required: true
      }
    }
  ],
  deductables: [
    {
      name: {
        type: String,
        required: true
      },
      amount: {
        type: Number,
        required: true
      }
    }
  ],
  is_delete: {
    type: Number,
    default: 0
  }
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can create a new schema for bonuses and deductables. Because the share all properties, you can even use the same schema for both. For example:

const BonusesDeductableSchema = new Schema({ 
    name: { type: String, required: true},
    amount: { type: String, required: true},
});

And then, apply this schema in your LevelSchema:

const LevelSchema = new Schema({
    name: {
        type: String,
        required: true
    },
    description: {
        type: String
    },
    basic: {
        type: Number,
        required: true
    },
    bonuses: [BonusesDeductableSchema],
    deductables: [BonusesDeductableSchema],
    is_delete: {
        type: Number,
        default: 0
    }
});

I think this should work.

Then, in your postman, something like this:

{
    "name": "string",
    "description": "string",
    "basic": 1,
    "bonuses": [
        {
            "name": "string",
            "amount": 1
        },
        {
            "name": "string",
            "amount": 1
        }
    ],
    "deductables": [
        {
            "name": "string",
            "amount": 1
        },
        {
            "name": "string",
            "amount": 1
        }
    ],
    "is_delete": 1
}

Hope I helped.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda