Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
4

Problens with System.Text.Json [C#]

gabrielbertoldo
gabrielbertoldo

for some reason the line of code using System.text.Json; wont work saying: error CS0234: The type or namespace name Json' does not exist in the namespaceSystem.Text'.Are you missing an assembly reference?

using System;
using System.IO;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;

class Empacotar
{
public static void GeraArquivo()
{
string jsonString;
jsonString = JsonSerializer.Serialize(jogador);
File.WriteAllText(fileName, jsonString);
}
}

3 years ago
You are viewing a single comment. View All
2
2
gabrielbertoldo
gabrielbertoldo

@a5rocks
Sure thing

3 years ago
2
a5rocks
a5rocks

@gabrielbertoldo
Hmm, not sure why, you might need to wait until someone who knows c# comes by. I tried looking it up, nothing there, and there seemed to be an alternative called System.Json which doesn't work either :(

3 years ago
1
gabrielbertoldo
gabrielbertoldo

@a5rocks
i think i should chance to xml looks like Json isn't working for some reason XS

3 years ago
2
SixBeeps
SixBeeps

@gabrielbertoldo
I know C# pretty well. Could you re-link the repl?

3 years ago
1
gabrielbertoldo
gabrielbertoldo

@SixBeeps
Sure

using System;
using System.IO;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;

class Empacotar
{
public static void GeraArquivo()
{
string jsonString;
jsonString = JsonSerializer.Serialize(jogador);
File.WriteAllText(fileName, jsonString);
}
}

3 years ago
2
SixBeeps
SixBeeps

@gabrielbertoldo
Do you have an actual Repl set up with that code?

3 years ago
1
gabrielbertoldo
gabrielbertoldo

@SixBeeps
i insert the repl entire code on the question i think you meant that right ?

3 years ago
2
SixBeeps
SixBeeps

@gabrielbertoldo
No, I mean the link to the editor where I can run your code

3 years ago