Comments (9)
I have, but if you want to talk about your rewrite there then don't. Sorry.
from sm-json.
I've just released v4.0.0. You can find the relevant documentation for this feature below:
Thanks again for the suggestion!
from sm-json.
You can try to use JSON_Object.Encode
with (or without) JSON_ENCODE_PRETTY
flag and then File.WriteLine
.
JSON_Object hObj = new JSON_Object();
hObj.SetInt( "key1", 50 );
hObj.SetString( "key2", "value" );
hObj.SetBool( "key3", true );
char szBuffer[PLATFORM_MAX_PATH];
BuildPath( Path_SM, szBuffer, sizeof szBuffer, "data/json.txt" );
File hFile = OpenFile( szBuffer, "w" );
hObj.Encode( szBuffer, sizeof szBuffer, JSON_ENCODE_PRETTY );
hFile.WriteLine( "%s", szBuffer );
hFile.Close();
hObj.Close();
from sm-json.
One question, in methodmaps, I had created a function AddField
, but that function fails, I had tried to use Length
and PushObject
but didn't worked, causing handle errors.
property JSON_Array Fields
{
public get()
{
return view_as<JSON_Array>(this.GetObject("fields"));
}
public set(JSON_Array value)
{
this.SetObject("fields", value);
}
}
public void AddField(const char[] name, const char[] value, bool inline)
{
JSON_Object hObj = new JSON_Object();
hObj.SetString("name", name);
hObj.SetString("value", value);
hObj.SetBool("inline", inline);
JSON_Array hArray = this.Fields;
PrintToServer("Bool: %i; Fields: %i", hArray.IsArray, this.Fields.IsArray);
if(hArray == null) {
hArray = new JSON_Array();
}
//json_array_append_new(hArray, hObj);
hArray.PushObject(hObj);
this.Fields = hArray;
delete hArray;
}
Yeah, I realized that and tried. It had worked, but still is somethign what would make a little easy the life of developers.
And I had created a new function json_rename()
to be able to rename the key values from JSON.
from sm-json.
Are you making something Discord-related? If yes then you should use Discord-API, there are methodmaps for embeds and fields (https://github.com/KillStr3aK/discord-api/blob/main/include/discord/DiscordEmbedField.inc).
from sm-json.
@MAGNAT2645 Yes, I'm rewriting the Discord API code base. The Discord API was using Jansson (extension), and I started yesterday on rewriting all the base to sm-json.
from sm-json.
No, Discord-API (which i provided above) uses sm-json.
from sm-json.
Yes, I had saw. I will continue to work on my rewrite with source inspiration from the other vendor.
This is the one, I rewrite Discord-API
Do you have discord? (Scai#8477)
from sm-json.
Thanks for the suggestion - will also be focusing on this for the upcoming release.
from sm-json.
Related Issues (20)
- Single Quotes HOT 2
- Default Values HOT 4
- Some Additions and Improvements HOT 7
- [Bug] json_decode, SM 1.11 HOT 1
- [Bug] Compilation error with global defined array HOT 1
- [Feature Req] implement function to convert Unicode escape sequences to Unicode characters HOT 2
- [Bug] json encoding utf-8 fails HOT 3
- Some optimization HOT 1
- [Feature Req] Sort order of keys of the second level depth HOT 5
- [Bug] Snapshots not deleted
- [Bug]Int64 Not supported HOT 4
- [Feature Req] Error Buffer HOT 1
- json_read_from_file handle is not closed HOT 1
- json_is_meta_key does not exist on v4 HOT 7
- [Bug] Error using json_cleanup_and_delete HOT 2
- [Bug] Ordered keys are not preserved on `DeepCopy()` HOT 4
- [Feature Req] Properly handle duplicate keys when decoding HOT 3
- [Bug] JSON objects passed to forwards then iterated on causes memory problems HOT 9
- [Suggestion] Some new useful functions HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sm-json.