× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks. I actually think I'm going to use addStmf(). I forgot it would
escape data when you add it. It will be a few days before I have test
data, but at least I know it should work.

Thanks again.

On Fri, Jun 21, 2024 at 9:22 PM Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
wrote:

You would use yajl_stringifyStr() to get the JSON document as a JSON
string (not escaped)

Then use YAJL_addChar() to add it as a string field in another JSON
document. (This will handle the escaping of characters -- not just for
JSON, but for any string you add to a JSON document. It literally doesn't
matter that your data happens to be JSON data... any data added to a JSON
string has to have double quotes (and sometimes other things) escaped.)
*Scott Klement*
Scott Klement Consulting LLC
https://www.scottklement.com
Cell: (414) 731-6581

[image: IBM Champion]

On 6/21/24 9:49 AM, Brad Stone wrote:

I have a project where I need to pass a JSON string as the contents of a
json object. (Please don't ask why.... I'm past that point.. haha).

Anyhow, does the yajl_stringify() or yajl_stringifyStr() function escape
the JSON so this can be done, or is that something I will need to do
manually. It looks like specifically the double quotes need to be escaped
with \".

Or is there a better way?

So basically I have to:

1. Build the first JSON
2. Stringify the JSON
3. Add that JSON as the value of another JSON document.

TIA!

Bradley V. Stonewww.bvstools.com
Native IBM i e-Mail solutions for Microsoft Office 365, Gmail, or any Cloud
Provider!



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.