NET interactive notebook, cannot use System.Text.Json

603 Views Asked by At

I am evaluating NET interactive notebooks. I downloaded the VS code extension and created a dib notebook file.

Following this example on how to include packages, I am getting a 401 unauthenticated response when trying to use System.Text.Json... Tbh, I'm at a loss about what's happening. Can you make sense of it?

#r "nuget:System.Text.Json"
var t = "ttt";
var x = new { t };
System.Console.WriteLine(JsonSerializer.Serialize(x));

enter image description here

Cheers

1

There are 1 best solutions below

3
On BEST ANSWER

You don't need to install nuget for System.Text.Json just add using System.Text.Json; to the top of your file instead of nuget import:

using System;
using System.Text.Json;
var t = "ttt";
var x = new { t };
Console.WriteLine(JsonSerializer.Serialize(x));