Libraries

s&box libraries

Easy Json

extended.easyjson

Simplifies json reading/writing by adding some extensions methods

About

Simplifies json reading/writing by adding some extensions methods

Example of usage:
public class JsonConverter : JsonConverter<Line>
{

public override Line? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if(typeToConvert != typeof(Line))
throw new ArgumentException($"Invalid type ({typeToConvert}).", nameof(typeToConvert));

if(reader.TokenType == JsonTokenType.Null)
return null;

Line line = new();

reader.ReadObjectProperties((ref reader, propertyName) => <--------
{
if(propertyName.SequenceEqual("Keys"u8)) <--------
{
reader.ReadArray((ref reader, index) => <--------
{
line.Add(reader.getByte());
});
}
}

return line;
}
}

All Features:
- JsonReadException
- Utf8JsonReader extensions- void AssertToken(JsonTokenType tokenType)
- void AssertToken(params IEnumerable<JsonTokenType> tokenTypes)
- JsonTokenType ReadOrThrow()
- JsonTokenType ReadTokenOrThrow(params IEnumerable<JsonTokenType> allowedTokenTypes)
- byte ReadByte()
- short ReadInt16()
- int ReadInt32()
- long ReadInt64()
- sbyte ReadSByte()
- ushort ReadUInt16()
- uint ReadUInt32()
- ulong ReadUInt64()
- float ReadSingle()
- double ReadDouble()
- decimal ReadDecimal()
- bool ReadBoolean()
- DateTime ReadDateTime()
- DateTimeOffset ReadDateTimeOffset()
- Guid ReadGuid()
- string? ReadString()
- void ReadObjectProperties(ReadPropertyDelegate readPropertyAction)
- void ReadObject(ReadPropertyDelegate readPropertyAction)
- void ReadArrayEntries(ReadArrayEntryDelegate readArrayEntryAction)
- void ReadArray(ReadArrayEntryDelegate readArrayEntryAction)
- ReadArrayEntries<T>(JsonSerializerOptions? options = null)
- ReadArray<T>(JsonSerializerOptions? options = null)
- Read<T>(JsonSerializerOptions? options = null)
- Get<T>(JsonSerializerOptions? options = null)

extendedjson

More by extended

01
Extended Box thumbnail
Extended Box extended.extendedbox

Things that are usefull in any s&box game

+0 24h
0favorites
1upvotes
21%Wilson score
02
Extended Collections thumbnail
Extended Collections extended.extendedcollections

Some collections and extension methods for collection

+0 24h
0favorites
0upvotes
--Wilson score
03
Extended Editor thumbnail
Extended Editor extended.extendededitor

No summary provided.

+0 24h
0favorites
0upvotes
--Wilson score
04
Extended Networking thumbnail
Extended Networking extended.extendednetworking

A library that simplifies networking

adminnetworkingrpc
+0 24h
0favorites
0upvotes
--Wilson score
05
Smarter Enum thumbnail
Smarter Enum extended.smarterenum

Smart enums that are classes just like in Java (I hate java)

enumextended
+0 24h
0favorites
0upvotes
--Wilson score