Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda