can someone with haskell or javascirpt show the output of whatever the closest thing you have to typeof(struct) is?

anything that shows the underlying contents?

@acw im a js boy! not sure exactly what you're asking tho?

@loam like if you assign a Json thing, can you return something that only has the keys? possibly in the sameish layout as the original Json?

@acw hmm give me a clearer idea of what you intend to do with that returned object, and I can give u some sample code

@loam check if two Json objects match in structure and types

@acw are you validating one JSON object against a known JSON-formatted schema? or are these going to be totally arbitrary JSON objects which need to be compared somehow?

the latter will probably be a bit harder but both should be doable.

@loam latter. I'm seeing how other langs deal with it. if it's not a built in , don't bother.

Follow

@acw not that I'm aware of, unfortunately. you could get basic functionality with a one-liner like:

Object.keys(obj).map(key => ({key:key, type: typeof obj[key]}))

but it doesn't account for nested arrays or objects. anyway no that functionality isn't built in, to my knowledge. sorry!

· · 0 · 0 · 1
Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!