JSON Aficionados Wanted!

Do you spend a lot of your time either performing CRUD operations with JSON data?

Is your life an endless stream of calls to an infinite and ever growing set of end-points with unstructured amorphous blobs of key-value pairs that you have to hack into your .NET code using various techniques and workarounds?

If so, tell me if this would help:

In the video I show how a hypothetical JSON literal feature in Visual Basic (inspired by our beloved XML literals) would let you copy & paste JSON from docs and other examples, transform and customize it to your needs, and send it off to a REST service in mere minutes.

Inspect JSON easily with the ! operator

Transform JSON with embedded expressions

Accelerate using REST services by tweaking JSON straight from the docs  

VB enthusiasts have asked about this for years, and I’d really like to advance the discussion on this topic from “Wouldn’t it be cool?” to “That would change my life!” and to do that the community needs to hear from developers who are up to their keyboards in JSON all day. That could be:

  • JSON accepting/returning web services
  • JSON files produced/read by other programs
  • JSON data stored or queried from SQL Server or another database system
  • Transmitting between server code and client-side JavaScript to create dynamic web pages
  • Or something else entirely that I haven’t thought of!

If you’re someone who is about that life or even just considering it please sound off below with your thoughts. And if you’re interested in more details check out the proposal on GitHub and leave feedback there as well and as always SHARE, SHARE, SHARE!



P.S. This is my second language feature prototype and I’m trying to take heart feedback from my first. Feel free to give me more feedback on the format itself and how I can improve it to reach more new and existing VB users. Thanks!

9 thoughts on “JSON Aficionados Wanted!

  1. Why use ! operator to access properties of the JSON object and not a . operator? Is this borrowed from somewhere else?


    • Hey @Mr. Mindor,

      The ! operator has been in VB for ages specifically for this scenario: accessing dictionaries like JSON. The issue with using a regular (.) is that whatever the type of the JSON object is, in this example is JObject class from Newtonsoft’s JSON.NET but even if it were another type, it has its own members so . is used to access the members statically defined on JObject. XML gets away with this because you don’t say .Element but .

      Some developers get around this by casting JObject to Object and using late-binding to access members through the DLR but that’s a *lot* of machinery at runtime to avoid having to use quotes and in VB there’s already an operator for that.

      In theory we could make a .”Element” operator just for JSON but it would overlap heavily with the existing ! operator and actually be 2 characters longer than ! and only 1 character shorter than just using the default property.

      But this is exactly the kind of feedback I’m looking for, so please keep asking questions/giving opinions!


  2. This would be great to see, and would allow VB.NET to catch up to Typescript as far as JSON handling is concerned. Next, of course, we’d be demanding object spreaders.

    Dim newObj = { …oldObj, { NewProperty = ‘Foo’ } }


    • Hmm. I’m not familiar with object spreaders. I’ll look into it! You should consider proposing on github.com/dotnet/vblang/


  3. I don’t really see the point of this – as I never saw the point of the already existing XML literals, because I never work with XML or JSON; those are just ways to interface data.
    So I only serialize and deserialize – both JSON and XML, and only work with classes.


    • Serialization is certainly a fair alternative and your experience is valid feedback. There are situations where serialization is less of a slam dunk which I’ll touch on whenever I finish the prototype I’m currently working on (it’s orthogonal to JSON literals, though), which is occupying so much of my thought.


  4. Pingback: Top-Level Code Prototype: Scenario D | Anthony's blog

  5. Pingback: Top-Level Code Prototype: Scenario E | Anthony's blog

  6. Pingback: Pattern-based XML Literals Prototype: Client-Side VB.NET Running in the Browser (sorta) | Anthony's blog

Comments are closed.