meuon,
@meuon@fosstodon.org avatar

JSON is usually beautifully simply and useful. I'm starting to see the same un-necessarily over-complicated nesting of simple data by API vendors as the XML crowd. All I'm missing is Base64encoded JSON inside of Base64encoded JSON.

(Used to see that in the XML world)

meuon,
@meuon@fosstodon.org avatar

New WTF?!? that has me wanting to thwack an API providers team:

In one place it needs (without quotes)

"invoiceTotal": 17.37,

In another it needs; (with quotes)

"invoiceTotal": "17.37",

but if I pass 17.37 (bare) to PHPs json_encode it wraps it in quotes. I can't use JSON_NUMERIC_CHECK because it breaks the things that should be strings like "01" instead of 1.

There are kludgy work arounds... or I can hand code my JSON, but WTF?!?

#PHP #JSON

derickr,
@derickr@phpc.social avatar

@meuon It doesn't wrap with "", only if it's a string: https://3v4l.org/nZEOj

meuon,
@meuon@fosstodon.org avatar

@derickr The value out of the DB call is effectively a string. I can (and did) change that, the frustration is they want it as a number in one place, and the same value as string in another. and they did this in multiple fields.

In my head there is only text. It's all just text. But that's just my strange way of looking at things.

derickr,
@derickr@phpc.social avatar

@meuon Sure, it's an odd API, but "but if I pass 17.37 (bare) to PHPs json_encode it wraps it in quotes." is an incorrect statement.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • tacticalgear
  • Youngstown
  • ngwrru68w68
  • ethstaker
  • slotface
  • PowerRangers
  • hgfsjryuu7
  • khanakhh
  • kavyap
  • tsrsr
  • InstantRegret
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • Leos
  • rosin
  • GTA5RPClips
  • thenastyranch
  • Durango
  • osvaldo12
  • vwfavf
  • modclub
  • everett
  • cisconetworking
  • cubers
  • normalnudes
  • tester
  • anitta
  • All magazines