How to strip optional null fields from json before processing
- Step 1Build the full record object with optional nulls — Create a record object with all possible fields, setting optional ones to null when not provided: { name: 'Alice', email: null, phone: null, bio: 'Developer' }.
- Step 2Strip null fields to create the PATCH payload — Paste the record and run the null stripper. The result { name: 'Alice', bio: 'Developer' } contains only the fields with values — safe to use as a PATCH body.
- Step 3Implement in the API client — Before every PATCH call: const payload = Object.fromEntries(Object.entries(updates).filter(([_, v]) => v !== null && v !== undefined)); await api.patch('/users/' + id, payload).
- Step 4Test with the stripped payload — Use the stripped payload as the test case for the PATCH endpoint. Verify the endpoint updates only the provided fields and leaves null-stripped fields unchanged.
Frequently asked questions
How does Prisma handle undefined vs null in update operations?+
Prisma treats undefined as 'skip this field' and null as 'set to null'. Pass undefined for fields you want to leave unchanged: await prisma.user.update({ where: { id }, data: { name: updates.name, email: updates.email ?? undefined } }). Using ?? undefined converts null to undefined, treating it as 'skip'.
When should I keep null in a PATCH payload instead of stripping it?+
Keep null when the intent is to explicitly clear a field. For example, removing a user's profile photo: { avatarUrl: null } should remain null so the server sets avatarUrl to null. Only strip null when null means 'I am not providing this field', not when it means 'clear this field'.
Is the record data transmitted to JAD Apps?+
No. Null stripping runs entirely in your browser. Record data is never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.